def my_while(cond) return @ret unless cond @ret = yield retry end my_while i<10 { puts "i: #{i}" j = 0 my_while j<10 { puts " j: #{j}" j+=1 } i+=1 }