Boolean values: Difference between revisions

Content added Content deleted
Line 1,073: Line 1,073:
=={{header|EMal}}==
=={{header|EMal}}==
<syntaxhighlight lang="emal">
<syntaxhighlight lang="emal">
^|EMal has a dedicated Logical type, and its keyword logic,
^|EMal has a dedicated Logical type expressed by the logic keyword.
|which holds the two values false and true.
|It holds the two values false and true.
|there are no implicit conversions, but explicit conversions
|There are no implicit conversions, but explicit conversions
|from/to int (0,1) or text("⊥", "⊤") are allowed
|from/to int (0,1) or text("⊥", "⊤") are allowed.
|^
|^
logic booleanTrue = true
logic booleanTrue = true
Line 1,089: Line 1,089:
writeLine("explicit conversion from text")
writeLine("explicit conversion from text")
end
end
watch(logic!"⊤") # is true
writeLine(int!true) # is one
watch(logic!0) # is false
writeLine(text!false) # is "⊥"
watch(int!true) # is one
watch(text!false) # is "⊥"
</syntaxhighlight>
</syntaxhighlight>
{{out}}
{{out}}
Line 1,099: Line 1,097:
explicit conversion from integer
explicit conversion from integer
explicit conversion from text
explicit conversion from text
1
Logical: <⊤>
Logical: <>
Integer: <1>
Text: <⊥>
</pre>
</pre>