Ruby Redo Retry

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Ruby redo Statement

Ruby redo statement is used to repeat the current iteration of the loop. The redo statement is executed without evaluating the loop's condition.

The redo statement is used inside a loop.

Syntax:

redo 

Example:

Output:

Ruby redo statement 1

Ruby retry Statement

Ruby retry statement is used to repeat the whole loop iteration from the start.

The retry statement is used inside a loop.

Syntax:

retry