Bird
0
0

You want to process numbers 1 to 5 in a Ruby loop. For number 3, you want to repeat processing it twice before continuing. Which keyword should you use inside the loop to repeat the current iteration?

hard📝 Application Q8 of 15
Ruby - Loops and Iteration
You want to process numbers 1 to 5 in a Ruby loop. For number 3, you want to repeat processing it twice before continuing. Which keyword should you use inside the loop to repeat the current iteration?
Anext
Bredo
Cbreak
Dretry
Step-by-Step Solution
Solution:
  1. Step 1: Understand keywords

    redo repeats current iteration without reevaluating condition.
  2. Step 2: Match requirement

    To repeat processing number 3 twice, redo is appropriate.
  3. Final Answer:

    redo -> Option B
  4. Quick Check:

    redo repeats iteration, next skips it [OK]
Quick Trick: Redo repeats iteration; next skips it [OK]
Common Mistakes:
  • Using next to repeat iteration
  • Confusing break with redo

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes