19 lines
597 B
Plaintext
19 lines
597 B
Plaintext
^|EMal has a dedicated Logical type expressed by the logic keyword.
|
||
|It's not nullable and holds the two values false and true.
|
||
|There are no implicit conversions, but explicit conversions
|
||
|from/to int (0,1) or text ("⊥", "⊤") are allowed.
|
||
|^
|
||
logic booleanTrue ← true
|
||
logic booleanFalse ← false
|
||
if 2 > 1 and true and not false
|
||
writeLine("true: ", true, ", false: ", false)
|
||
end
|
||
if false æ logic!0
|
||
writeLine("explicit conversion from integer")
|
||
end
|
||
if true æ logic!"⊤"
|
||
writeLine("explicit conversion from text")
|
||
end
|
||
writeLine(int!true) # is one
|
||
writeLine(text!false) # is "⊥"
|