19 lines
596 B
Text
19 lines
596 B
Text
|
|
^|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 "⊥"
|