Swift Logical Operators
Swift Logical Operators
Combine booleans with && (AND), || (OR), and ! (NOT).
Logical AND (&&)
Both must be true for the result to be true.
Example
let isOwner = true
let isAdmin = false
print(isOwner && isAdmin)
print(true && true)
Logical OR (||)
At least one true makes the result true.
Logical NOT (!)
Flip a boolean value: true becomes false and vice versa.