Boolean values: Difference between revisions

Content added Content deleted
No edit summary
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,
|which 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 booleanTrue = true
logic booleanFalse = false
logic booleanFalse = false
Line 1,084: Line 1,089:
writeLine("explicit conversion from text")
writeLine("explicit conversion from text")
end
end
watch(logic!"⊤") # is true
watch(logic!0) # is false
watch(int!true) # is one
watch(text!false) # is "⊥"
</syntaxhighlight>
</syntaxhighlight>
{{out}}
{{out}}
Line 1,090: Line 1,099:
explicit conversion from integer
explicit conversion from integer
explicit conversion from text
explicit conversion from text
Logical: <⊤>
Logical: <⊥>
Integer: <1>
Text: <⊥>
</pre>
</pre>