Bird
0
0

Why does YARD allow multiple @param tags with the same parameter name but different types?

hard📝 Conceptual Q10 of 15
Ruby - Ecosystem and Best Practices
Why does YARD allow multiple @param tags with the same parameter name but different types?
ATo generate errors for ambiguous documentation.
BBecause YARD does not check for duplicate tags.
CTo document different parameters with the same name in overloaded methods.
DTo document that the parameter can accept multiple types (union types).
Step-by-Step Solution
Solution:
  1. Step 1: Understand YARD's support for union types

    YARD allows multiple @param tags for the same parameter to indicate it accepts multiple types.
  2. Step 2: Eliminate incorrect reasons

    YARD does check tags; Ruby does not support method overloading; errors are not generated for this.
  3. Final Answer:

    To document that the parameter can accept multiple types (union types). -> Option D
  4. Quick Check:

    Multiple @param tags = union types [OK]
Quick Trick: Multiple @param tags mean parameter accepts multiple types [OK]
Common Mistakes:
  • Thinking YARD ignores duplicate tags
  • Assuming Ruby supports method overloading
  • Believing YARD throws errors for duplicates

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes