Sep 23, 2024
Not
operatorAnd
operatorOr
operator!
).x
is true, not x
is false.x
is false, not x
is true.&&
).x && y
is true if both x
is true and y
is true.||
).x || y
is true if either x
or y
is true, or both.x
and y
are false.lightOn
and set it to true.not
operator is applied:
lightOn
is switched to false.boolean lightOn = true;
print(lightOn); // Outputs: true
Not
:
lightOn = !lightOn;
print(lightOn); // Outputs: false
not
is applied again.and
, or
, and not
operators to reinforce understanding.