Bird
0
0

Which of the following heredoc endings is correct to close this heredoc?

easy📝 Syntax Q3 of 15
Ruby - String Operations
Which of the following heredoc endings is correct to close this heredoc?
text = <<-END
Hello World
END
Aend
BeND
CEnd
DEND
Step-by-Step Solution
Solution:
  1. Step 1: Check heredoc delimiter case sensitivity

    The heredoc delimiter must exactly match the starting label, including case.
  2. Step 2: Match the ending delimiter

    The heredoc started with <<-END must be closed with END in uppercase exactly.
  3. Final Answer:

    END -> Option D
  4. Quick Check:

    Heredoc delimiter case sensitive = B [OK]
Quick Trick: Match heredoc end label exactly, including case [OK]
Common Mistakes:
  • Using lowercase 'end' instead of 'END'
  • Mixing letter cases in delimiter
  • Adding extra spaces after delimiter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes