Bird
0
0

Why does the redo keyword not reevaluate the loop condition in Ruby?

hard📝 Conceptual Q10 of 15
Ruby - Loops and Iteration
Why does the redo keyword not reevaluate the loop condition in Ruby?
ABecause <code>redo</code> pauses the loop until a condition is met.
BBecause <code>redo</code> is designed to exit the loop immediately.
CBecause <code>redo</code> skips the current iteration and moves to the next.
DBecause <code>redo</code> restarts the current iteration without moving forward or checking conditions again.
Step-by-Step Solution
Solution:
  1. Step 1: Understand redo's behavior

    redo repeats the current iteration without advancing the loop or checking the condition again.
  2. Step 2: Clarify why condition is not reevaluated

    This is by design to allow repeating the same iteration fully.
  3. Final Answer:

    Because redo restarts the current iteration without moving forward or checking conditions again. -> Option D
  4. Quick Check:

    Redo repeats iteration without condition check [OK]
Quick Trick: Redo repeats iteration without condition check [OK]
Common Mistakes:
  • Thinking redo exits loop
  • Confusing redo with next
  • Assuming redo pauses loop

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes