Loop while

while t.gets !~ /[Cc]onnect/ do end
begin end while t.gets !~ /[Cc]onnect/
until t.gets =~ /[Cc]onnect/ do end
begin end until t.gets =~ /[Cc]onnect/
loop do break if t.gets =~ /[Cc]onnect/ end

cool :slight_smile:

btw, I tried replacing “do end” with “{}” and I noticed that the replacement
does not work when done at end of construct

eg.

while gets !~ /[Cc]onnect/ {} #does not work

but

{} while gets !~ /[Cc]onnect/

what gives? am I wrong on the assumption that “{-}” and “do-end” are same?

eban

kind regards -botp

···

sir WATANABE Hirofumi [mailto:eban@os.rim.or.jp] wrote:

{} while gets !~ /[Cc]onnect/

You have written something like this

   Hash.new while gets !~ /[Cc]onnect/

`while' is used as a statement modifier

Guy Decoux