From: "David A. Black" Date: 2008-06-19T00:56:28+09:00 Subject: Re: print(true and true) #=> the parenthesis issue Hi -- On Thu, 19 Jun 2008, Dave Bass wrote: > Robert Klemme wrote: >> x = some_work() >> putx x if x > > I carefully set my little trap... and it caught someone! :-D > > Note that I wrote "Clarity wins over conciseness every time for me." The > more English-like the code is, the easier it is to understand (for me > anyway). The fact that my version is a few characters longer is > unimportant. Hopefully it won't phase Ruby; anyway, I'm the boss and it > can do what I say. Your version only tests for false, not both false and nil, so it's not equivalent to the 'and' one or to Robert's last one. The abstraction of the nil and false objects into the category of boolean falsehood, which will fail an 'if' test, isn't *that* hard to get :-) And then you get to have code that's both short and clear :-) David -- Rails training from David A. Black and Ruby Power and Light: ADVANCING WITH RAILS June 16-19 Berlin ADVANCING WITH RAILS July 21-24 Edison, NJ See http://www.rubypal.com for details and updates!