This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
David Heinemeier Hansson (author)
Sun Apr 27 15:15:50 -0700 2008
commit 162c7c1908946cfb48c201cfc5a4976a33c8bff1
tree f09f5e887bedb4d44a7c6884d471b0bdcc34293c
parent a37546517dad9f6d9a7de6e1dba4d960909d71e8
tree f09f5e887bedb4d44a7c6884d471b0bdcc34293c
parent a37546517dad9f6d9a7de6e1dba4d960909d71e8
... |
... |
|





Comments
Oh, boo, booooo.
It makes sense to be consistent, Klondike. Due to the low precedence of “and” and “or” they work best as postfix jump statements/control flow like “and return” or “or raise.” While && and “and” are equivalent in this usage, it’s good to stick to ones own conventions, as there are other times it can bite you (like in assignments).
Hi David,
Could you justify please why ‘&&’ and not ‘and’?
Maybe this might give you a clue:
http://www.pjhyett.com/posts/201-using-or-and-in-ruby
PJ Hyett’s rundown is good. The 95% case is to want the && behavior and when it doesn’t matter it’s better to use ‘&&’ for consistency.
I get the argument for consistency, but in this case consistency isn’t worth it to me, ‘and’ and ‘or’ are so much more readable that I’ll use the && alternative only when I need to. Obviously it’s subjective, but I think it’s one of the nicer syntactic sugars in Ruby and I’m surprised to see the Rails community pass it by because someone finally pointed out a pitfall associated with it.
Klondike, you’re free to use either in your Rails project. We just prefer && and || in the Rails source because it is easier for use to understand what is going on and avoid any unintended consequences.
Inconsistent code is less readable than consistent code. Hurray &&.
Truly.
I like throwing “ands” around and dropping as many parentheses as possible when I’m feeling why-the-lucky-stiff-ish, but I don’t want that stuff in code I want to maintain.
Awesome new word: whytheluckystiffish d-:
Klondike:
Some people replace the words ‘you’, ‘are’ and ‘two’ with ‘u’, ‘r’, and ‘2’. Surely you can read && as and and || as or.