Boolean#
Boolean Values#
Boolean: the last of the simple ones
>>> 1 < 2
True
>>> 'X' == 'U'
False
|
|
Boolean Operators#
Usual operators …
L and R:Trueif bothLandRevaluate toTrueL or R:TrueifLorRevaluate toTruenot X:TrueifXevaluates toFalse
Short circuit evaluation: operands are only evaluated until the expression’s value is clear
L and R: ifLisFalse, then the expression cannot becomeTrueanymore ⟶Rnot evaluatedL or R: ifLisTrue, …⟶ important when
L,Rare functions with side effects