logical_operators
🔀 Logical Operators​
Combine boolean expressions with &&
(and), ||
(or), and !
(not). These help you build complex conditions in if
, while
, and other control structures.
logged_in = true
admin = false
# AND: true only if both are true
logged_in && admin # false
# OR: true if either is true
logged_in || admin # true
# NOT: flips the boolean
!logged_in # false