From: Brian Candler Date: 2010-09-29T05:36:58+09:00 Subject: Re: puts and return Rick Denatale wrote: > puts "Too big" || break if i > 5 > > Doesn't cause the break. > > I think this is because break really isn't an expression. I think that's parsed as: puts("Too big" || break) if i > 5 and since "Too big" is always true, the RHS of || is never evaluated. > The best solution seems to be > > if i > 5 > puts "Too big" > break > end I agree that's the clearest. For a one-liner I'd do: (puts "Too big"; break) if i > 5 -- Posted via http://www.ruby-forum.com/.