On 5/31/07, Eric Armstrong <[EMAIL PROTECTED]> wrote:
Ruby Code:
- always use && and ||, not 'and' and 'or'
Why is that? For consistency with Java? Or is there
some other benefit?
This is a convention in Rails core. Its origin is that 'and' and 'or'
have priority lower than && and ||, and lower than assignment. Which
sometimes leads to unexpected behavior.
E.g.
x = y && z
is no the same as
x = y and z
Personally, I like 'and' and 'or' because it often reads better than && and ||.
Especially in statement like
redirect_to :action => "show" and return
or
foo = find_foo or raise 'Foo not found'
--
Alex
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email