Bird
0
0

Why does Ruby allow methods to end without explicit return statements, and how does this relate to developer happiness?

hard📝 Conceptual Q10 of 15
Ruby - Basics and Runtime
Why does Ruby allow methods to end without explicit return statements, and how does this relate to developer happiness?
ABecause Ruby returns the last evaluated expression automatically, reducing boilerplate
BBecause Ruby requires explicit return for clarity
CBecause Ruby ignores method return values by default
DBecause Ruby uses semicolons to separate return values
Step-by-Step Solution
Solution:
  1. Step 1: Recall Ruby's method return behavior

    Ruby returns the last evaluated expression automatically without needing return keyword.
  2. Step 2: Connect this behavior to developer happiness

    This reduces extra code and makes methods cleaner and easier to read, enhancing happiness.
  3. Final Answer:

    Because Ruby returns the last evaluated expression automatically, reducing boilerplate -> Option A
  4. Quick Check:

    Implicit return = less code, more happiness [OK]
Quick Trick: Last expression is returned automatically in Ruby methods [OK]
Common Mistakes:
  • Thinking explicit return is always required
  • Believing Ruby ignores return values
  • Confusing semicolons with return statements

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes