From: Jim Haungs Date: 2010-09-29T05:33:10+09:00 Subject: Re: puts and return Yep. This is pretty much where I went with it, too. Pragmatic trumps terse. Now I'm going to go look for 'and's in my code. :-) Rick Denatale wrote: > On Tue, Sep 28, 2010 at 4:14 PM, Kirk Haines wrote: >> >> && is what you want, to get that effect. > > No that doesn't work, since puts returns nil and nil || whatever > doesn't evaluate whatever. > > And > > puts "Too big" || break if i > 5 > > Doesn't cause the break. > > I think this is because break really isn't an expression. > > The best solution seems to be > > if i > 5 > puts "Too big" > break > end > > Both because it works, and I don't put too much weight on marginally > shorter code. > > > -- > Rick DeNatale -- Posted via http://www.ruby-forum.com/.