Ruby/Statement/redo

Материал из Wiki.crossplatform.ru

Версия от 18:00, 13 сентября 2010; ViGOur (Обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

redo Repeats the current loop iteration (without reevaluating the loop"s 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