Bird
0
0

Identify the problem in this Ruby code:

medium📝 Debug Q7 of 15
Ruby - Control Flow
Identify the problem in this Ruby code:
puts 'Done' unless
ANo problem, code is valid
BMissing condition after unless
CIncorrect use of puts
DMissing parentheses around condition
Step-by-Step Solution
Solution:
  1. Step 1: Review inline unless syntax

    Inline unless requires a condition after unless keyword.
  2. Step 2: Detect missing condition

    The code ends with unless but no condition is provided, causing syntax error.
  3. Final Answer:

    Missing condition after unless -> Option B
  4. Quick Check:

    Inline unless must have condition [OK]
Quick Trick: Inline unless needs condition after unless [OK]
Common Mistakes:
  • Omitting condition
  • Adding parentheses unnecessarily
  • Assuming puts causes error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes