redo [expression]


The redo command restarts a loop block without evaluating the conditional again. The optional expression argument may evaluate to a positive integer number that indicates which level of the nested loops should be restarted. If omitted, it defaults to 1, i.e. the innermost loop.

Using this command outside a loop causes an immediate run-time error.

Example 24. Restart a higher level loop from an inner one

while ($i<100) { 
  # ...
  foreach //para {
    # some code
    if $param { 
      redo; # redo foreach loop
    } else {
      redo 2; # redo while loop

See Also

foreach, while, iterate, next, last