System.Boolean - Manhunter07/MFL GitHub Wiki
Declaration
type Boolean = enum(System.False, System.True)
constructor Boolean(Value) = \built-in\
Description
The Boolean
type in the System
package represents the a constraint for booleans values. Allowed values are either False
or True
. Booleans are used for binary decision making as well as to display the correctness of a term.
Similarly to the null
value type, booleans only allow a pre-defined set of values that are represented as unresolvable constants.
Operator compatibility
Boolean operators like ~=
, ?=
or ^=
return boolean values. Anything returned by them is considered a value supported by this type. The ?
operator might return -1
in some cases and can therefore not be used to construct the argument for a Boolean
-typed parameter.
Constructor
The Boolean
type has an intrinsic constructor defined in the same package. It returns True
if the value for non-empty values, or False
for empty values. A possible declaration of this constructor could be:
constructor Boolean(Value) = if Value then True else False
The constructor could also be described as:
constructor Boolean(Value) = Value ?= True
Another possible way to write this would be:
constructor Boolean(Value) = |?Value|