Bird
0
0

Which of the following is the correct way to document a method parameter using YARD?

easy📝 Syntax Q12 of 15
Ruby - Ecosystem and Best Practices
Which of the following is the correct way to document a method parameter using YARD?
A# @param name [String] the user's name
B// @param name String the user's name
C/* @param name String the user's name */
D<!-- @param name String the user's name -->
Step-by-Step Solution
Solution:
  1. Step 1: Recognize Ruby comment style

    Ruby uses # for single-line comments, so YARD tags must start with #.
  2. Step 2: Identify correct YARD tag syntax

    The correct format is "# @param name [Type] description".
  3. Final Answer:

    # @param name [String] the user's name -> Option A
  4. Quick Check:

    # -> Ruby comments [OK]
Quick Trick: YARD tags start with # in Ruby code comments [OK]
Common Mistakes:
  • Using comment styles from other languages
  • Omitting square brackets around type
  • Writing tags inside HTML or block comments

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes