Logical operations
There are some operations that can be done to booleans to combine or change their results.
!
The not operator, it negates the boolean (
!true
equalfalse
and!false
equalstrue
).&&
The and operator, it requires both booleans to be
true
, else it returnsfalse
(true&&true
equalstrue
,true&&false
and any other combination equalsfalse
).||
The or operator, it requires any of the booleans to be true, it returns
false
if both arefalse
(false||false
equalsfalse
,true&&false
and any other combination equalstrue
).
Last modified: 16 October 2024