Learn
Excellent work! 👏 In this lesson, we’ve learned the following concepts:
- The logical
&&
operator translates to AND and returnstrue
only when both operands aretrue
. It returnsfalse
in all other cases. - The logical
||
operator translates to OR and returnstrue
when either operands aretrue
. When both operands arefalse
, the logical expression evaluates tofalse
. - The logical
!
operator translates to NOT and negates a Boolean value. - The
&&
operator has a higher precedence over the||
operator. - Parentheses,
()
, may be used in a logical expression to control the order of operations and improve readability.
Feel free to utilize the empty Review.swift file and output terminal on the right to hone your understanding of logical operators and practice writing Swift code!
Instructions
When you’re ready to move on, click Up Next.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.