Course Content

Course Content

FAQs

The redo statement is used to repeat a block of code that has just been executed. It is often used to repeat the same method call, or a sequence of statements.

Ruby provides three different ways to use the redo statement. The first way is to use it as a conditional statement, where the condition is whether or not the Ruby program has executed the loop at least once. The second way is to use it as an unconditional command, so that any number of times can be executed. The third way is to use it with a block of code like other programming languages do with loops.

The redo statement can be used with three different forms:

  • redo # undoes the last change
  • redo x # undoes x changes
  • redo x, y, z # undoes x, y and z changes

The Redo statement in Ruby is used to repeat the current loop iteration. Inside the loop, redo is always utilised. The redo statement returns the loop to its previous state without re-evaluating the condition.

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
Apple App Store
598K+ Downloads
App Download Section Circle 1
4.57 Avg. Ratings
App Download Section Circle 2
15K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere