Bird
0
0

Which of the following is the correct syntax to start a heredoc string named TEXT in Ruby?

easy📝 Syntax Q12 of 15
Ruby - String Operations
Which of the following is the correct syntax to start a heredoc string named TEXT in Ruby?
A<< TEXT
B<<TEXT
C<TEXT<<
DTEXT<<
Step-by-Step Solution
Solution:
  1. Step 1: Recall heredoc start syntax

    Heredoc starts with << followed immediately by an identifier, e.g., <
  2. Step 2: Check each option

    <<TEXT matches the correct syntax. << TEXT with space is invalid. Arrangements like
  3. Final Answer:

    <<TEXT -> Option B
  4. Quick Check:

    Start heredoc with <<IDENTIFIER [OK]
Quick Trick: Heredoc starts with << followed by the identifier [OK]
Common Mistakes:
MISTAKES
  • Putting identifier before <<
  • Using incorrect symbols like < or - wrongly
  • Confusing heredoc start with end

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes