> and a solution flow similar to
>
> ruby> def WHILE(cond)
>     |   return if not cond
>     |   yield
>     |   retry
>     | end
>    nil
> ruby> i=0; WHILE(i<3) { print i; i+=1 }

This WHILE loop will not work because the condition is only evaluated 
once. If you want it to work you need to turn the condition into a 
lambda, like so:

def WHILE(cond)
  loop do
    return if !cond.()
    yield
  end
end

and use like this:

i = 0
WHILE(->{i < 3}) { puts i; i+=1 }

-- 
Posted via http://www.ruby-forum.com/.