From: Dave Bass Date: 2008-06-19T18:16:03+09:00 Subject: Re: print(true and true) #=> the parenthesis issue Robert Klemme wrote: > Exactly. That's why I offered a variant that not only has the same > semantics as my version with "and" but also reads much better than > your double negation. But my double negation is completely and absolutely clear! The whole point of putting "unless x == false" is that it WON'T respond to nil, only to false. The x variable is presumably supposed to be Boolean, i.e. true/false. If there's a possibility that some_work() could return nil and assign it to x, it's likely to be because something went wrong within some_work(). That can and should be picked up by a separate test such as "if x.nil?". It's shortcuts like writing "if x" instead of "unless x == false" that conceal the potential for bugs. If one means "unless x == false" then one should write it. If on the other hand one means "unless (x == false || x == nil)" then one should write that instead. Clarity is more important than conciseness. Dave -- Posted via http://www.ruby-forum.com/.