Bird
0
0

What does the logical AND operator (&&) do in Swift?

easy📝 Conceptual Q2 of 15
Swift - Operators and Expressions
What does the logical AND operator (&&) do in Swift?
AReturns true if both conditions are true
BReturns true if either condition is true
CNegates the condition
DChecks if two values are equal
Step-by-Step Solution
Solution:
  1. Step 1: Understand AND operator behavior

    The AND operator (&&) returns true only when both conditions are true.
  2. Step 2: Differentiate from other operators

    OR returns true if either is true, NOT negates, and equality checks values, so they don't match.
  3. Final Answer:

    Returns true if both conditions are true -> Option A
  4. Quick Check:

    Logical AND = true only if both true [OK]
Quick Trick: AND requires both conditions true to return true [OK]
Common Mistakes:
  • Mixing AND with OR
  • Thinking AND negates
  • Confusing equality with logical operators

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Swift Quizzes