From: "Grzegorz Chrupała" Date: 2004-02-15T01:39:56+09:00 Subject: Re: Simple litle style question Kirk Haines wrote: > This is just a simple little stylistic query that I became curious about > after one of Ara Howard's questions the other day. > > In general, do people prefer: > > def simpleExample(t) > x = block_meth do > r = nil > if t == 'forty-two' > r = 42 > else > r = 0 > end > r > end > > x > end > > > or: > > def simpleExample(t) > x = block_meth do > if t == 'forty-two' > r = 42 > else > r = 0 > end > end > end > I would do the following, which is more in the spirit of an expression-based language: def simpleExample(t) block_meth do if t == 'forty-two' then 42 else 0 end end end Personally, I wouldn't assign to variables that I'm not going to use. -- Grzegorz Chrupała | http://pithekos.net | grzegorzc@jabber.org