From: Rich Kilmer Date: 2002-09-26T23:16:27+09:00 Subject: RE: call for commentary: review of Ruby for a magazine (long, sorry!) > -----Original Message----- > From: dave@thomases.com [mailto:dave@thomases.com] On Behalf > Of Dave Thomas > Sent: Thursday, September 26, 2002 9:54 AM > To: ruby-talk ML > Subject: Re: call for commentary: review of Ruby for a > magazine (long, sorry!) > > > William Djaja Tjokroaminata writes: > > > if obj.nil?: puts "warning" > > > I think I have minimized my typing (good for my hands) > > Except the conventional Ruby syntax > > puts "warning" if obj.nil? > > is actually one less keystroke, and a shifted key one that (on my > keyboard...) > Interesting...I usually do: puts "warning" unless obj Since obj is true if not nil The "if obj.nil?" may appear clearer, but 'unless obj' is easy to grok as well. And of course this works only for cases where obj is not a boolean value... -rich