Booleans - Manhunter07/MFL GitHub Wiki
Booleans are binary values that support two distinct states: true (represented by True) and false (represented by False). A boolean can be either, but not both or none. The Boolean type represents the common type constraint for boolean values.
Operators
See also: Operators#Booleans
Unary
| Operator | Operation |
|---|---|
+ |
|
- |
Negation (NOT) |
The positive prefix operator (+) does not perform any operation.
A negation (-), also known as logical NOT, inverts the operand and returns True for False and False for True.
Binary
| Operator | Operation |
|---|---|
+ |
Conjunction (AND) |
* |
Disjunction (OR) |
?= |
Equality |
Conjunction
| First operand | Second operand | Result |
|---|---|---|
False |
False |
False |
False |
True |
False |
True |
False |
False |
True |
True |
True |
A conjunction (+), also known as logical AND, returns True if both operands are True, otherwise False.
Disjunction
| First operand | Second operand | Result |
|---|---|---|
False |
False |
False |
False |
True |
True |
True |
False |
True |
True |
True |
True |
A disjuncion (*), also known as logical OR, returns True if either operand is True, otherwise False.
Type check
Like any other data type, booleans support the type compatibility check operator (?:). It returns True on the Boolean type, but also any other type that supports the respected value(s).