From: Ryan Davis Date: 2012-07-17T06:37:03+09:00 Subject: Re: learning by doing part 2 - tc game On Jul 14, 2012, at 03:07 , Jan E. wrote: > You seem to be coming from a language like Java or so. Note that Ruby > does *not* have a "do-until" or a "do-while" loop. You have to use an > endless loop with a conditional "break" at the end. > > This "begin-end-until" actually looks like a "do-until" loop, but it's > not. It's just the same as "until ... do ... end". I'd actually avoid > this notion completely, because it's very ambiguous and hard to read. > Use the appended "until", "while", "if" etc. only for single line > statements. No, begin/end/(while|until) is NOT the same as (while|until)/end: % ruby -e 'begin puts "bad"; end while false' bad % ruby -e 'while false do puts "bad"; end ' %