Ah, many thanks, I was thinking the difference between && and 'and'  
was bitwise vs. logical.

Ken
On Oct 1, 2008, at 4:20 PM, Frederick Cheung wrote:

>
>
>
> On Oct 1, 8:14 pm, Kenneth McDonald <[EMAIL PROTECTED]>
> wrote:
>>         <%= counter%4==3 and counter > 1 ? "</tr>" : "" %>
>>
>> Anyone know where those 'false's are coming from? It's got me  
>> stumped.
>>
>
> The line above is the culprit, and the problem is that you have used
> and instead of &&. and has very low precedence, so the above is
> equivalent to
>
> (counter%4==3) and (counter > 1 ? "</tr>" : "")
>
> (ie the whole expression evaluates to false if counter is not
> congruent to 3 mod 4)
>
> && has higher precedence, replacing the and with && would make it
> equivalent to
>
> ((counter%4==3) and (counter > 1)) ? "</tr>" : "")
>
> which is what you want.
>
> Fred
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to