RosettaCodeData/Task/Boolean-values/EMal/boolean-values.emal

19 lines
596 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
^|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 "⊥"