Bird
0
0

Which logical operator in Swift returns true only if both conditions are true?

easy📝 Conceptual Q11 of 15
Swift - Operators and Expressions
Which logical operator in Swift returns true only if both conditions are true?
A== (Equality)
B|| (OR)
C&& (AND)
D! (NOT)
Step-by-Step Solution
Solution:
  1. Step 1: Understand the AND operator

    The AND operator (&&) returns true only when both conditions it connects are true.
  2. Step 2: Compare with other operators

    The OR operator (||) returns true if at least one condition is true, NOT (!) flips true to false and vice versa, and == checks equality, not logical combination.
  3. Final Answer:

    && (AND) -> Option C
  4. Quick Check:

    AND = && [OK]
Quick Trick: AND needs both true; look for && operator [OK]
Common Mistakes:
  • Confusing AND (&&) with OR (||)
  • Thinking NOT (!) combines conditions
  • Mixing equality (==) with logical operators

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Swift Quizzes