Mega Code Archive

 
Categories / Ruby / Statement
 

Redo Repeats the current loop iteration (without reevaluating the loops condition or getting the next item from an iterator)

i = 0 while(i < 3)   # Prints "0123" instead of "012"   # Control returns here when redo is executed   print i   i += 1   redo if i == 3 end