Bird
0
0

What does the Ruby logical operator || do?

easy📝 Conceptual Q2 of 15
Ruby - Operators and Expressions
What does the Ruby logical operator || do?
AReturns true if both operands are true
BReturns false if both operands are true
CReturns true if at least one operand is true
DReturns the opposite of the operand
Step-by-Step Solution
Solution:
  1. Step 1: Understand the OR operator (||)

    The OR operator returns true if at least one operand is true.
  2. Step 2: Match the description

    Returns true if at least one operand is true correctly describes the OR operator behavior.
  3. Final Answer:

    Returns true if at least one operand is true -> Option C
  4. Quick Check:

    Logical OR true || false = true [OK]
Quick Trick: || returns true if either side is true [OK]
Common Mistakes:
MISTAKES
  • Mixing up && and ||
  • Thinking || returns false if one side true
  • Confusing with NOT operator

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes