Bird
0
0

Which of the following is the correct syntax for an until loop in Ruby?

easy📝 Syntax Q12 of 15
Ruby - Loops and Iteration
Which of the following is the correct syntax for an until loop in Ruby?
Auntil condition then # code end
Buntil (condition) { # code }
Cuntil condition: # code
Duntil condition do # code end
Step-by-Step Solution
Solution:
  1. Step 1: Recall Ruby loop syntax

    Ruby uses until condition do ... end or just until condition ... end.
  2. Step 2: Check each option

    until condition do # code end matches Ruby syntax; others use wrong symbols or keywords.
  3. Final Answer:

    until condition do\n # code\nend -> Option D
  4. Quick Check:

    Ruby until loop uses do/end syntax [OK]
Quick Trick: Use do/end blocks for until loops in Ruby [OK]
Common Mistakes:
  • Using curly braces {} instead of do/end
  • Using colon : like Python
  • Adding 'then' keyword incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes