Bird
0
0

How can you write a multi-line comment that is ignored by Ruby but also clearly separated for documentation tools?

hard📝 Application Q9 of 15
Ruby - Basics and Runtime
How can you write a multi-line comment that is ignored by Ruby but also clearly separated for documentation tools?
AUse multiple # lines before the code
BUse =begin and =end around the comment block
CUse /* and */ to wrap the comment
DWrite comments inside strings
Step-by-Step Solution
Solution:
  1. Step 1: Recall Ruby multi-line comment syntax

    Ruby supports multi-line comments using =begin and =end on separate lines.
  2. Step 2: Confirm documentation tool compatibility

    These markers clearly separate comment blocks and are ignored by Ruby.
  3. Final Answer:

    Use =begin and =end around the comment block -> Option B
  4. Quick Check:

    Multi-line comments = =begin/=end [OK]
Quick Trick: Use =begin and =end for clear multi-line comments [OK]
Common Mistakes:
  • Using /* */ from other languages
  • Writing comments inside strings
  • Using only single # lines for multi-line

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes