Bird
0
0

Why does the Ruby style guide recommend using snake_case for method and variable names instead of camelCase?

hard📝 Conceptual Q10 of 15
Ruby - Ecosystem and Best Practices
Why does the Ruby style guide recommend using snake_case for method and variable names instead of camelCase?
ABecause snake_case is faster to type on all keyboards
BBecause snake_case improves readability and matches Ruby community conventions
CBecause camelCase causes syntax errors in Ruby
DBecause camelCase is reserved for constants only
Step-by-Step Solution
Solution:
  1. Step 1: Understand Ruby naming conventions

    Ruby community prefers snake_case for readability and consistency.
  2. Step 2: Evaluate reasons for style guide recommendation

    Snake_case is not about syntax errors or speed but about clarity and convention.
  3. Final Answer:

    Because snake_case improves readability and matches Ruby community conventions -> Option B
  4. Quick Check:

    Snake_case preferred for readability and community style [OK]
Quick Trick: Snake_case is Ruby's community standard for names [OK]
Common Mistakes:
  • Thinking camelCase causes errors
  • Confusing constants with camelCase
  • Assuming typing speed matters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes