411 REFERENCE · Wikibooks
OpenSCAD User Manual/Booleans
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
part of the section on Values, Data Types, and Constants
Boolean Values
Booleans have two states, true or false.
They are the natural result of relational tests ( this==that, this<that, etc. ) and are primarily used as the conditional element in an 'if()' statement or the '? :' ternary operator.
More complex boolean expressions may be formed using the logical operators for NOT, AND, and OR ( '!', "&&", "||" respectively).
NOTE the NOT EQUALS ( "!=" ) relational operator has the effect of being an XOR (exclusive OR) operator.
As variables in OpenSCAD do not have a type the evaluation of an expression being used as the Condition Expression in an if statement may not give a Boolean result.
The Non-Boolean values that are considered false are:
0 and -0
"", the null string
[], the empty list (or vector)
undef
Similar Non-Boolean values that are actually true are:
"false" not a null string
[0] a vector with a single numeric element
[ [] ] outer vector is not empty
[false] a vector with a single boolean element
0/0 divide by zero gives the Not A Number result.