Bird
0
0

Find the error in this Ruby code:

medium📝 Debug Q14 of 15
Ruby - Basics and Runtime
Find the error in this Ruby code:
puts "Hello World
ANo error, code is correct
BMissing parentheses after puts
Cputs should be capitalized
DMissing closing double quote
Step-by-Step Solution
Solution:
  1. Step 1: Check string syntax

    The string starts with a double quote but does not have a closing double quote.
  2. Step 2: Verify other syntax parts

    Parentheses are optional in Ruby for puts, and puts is lowercase by convention, so no error there.
  3. Final Answer:

    Missing closing double quote -> Option D
  4. Quick Check:

    Unclosed string causes syntax error [OK]
Quick Trick: Always close your quotes in strings [OK]
Common Mistakes:
  • Forgetting to close quotes
  • Thinking parentheses are mandatory
  • Capitalizing puts incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes