Performing operations from boolean algebra is also quite straightforward in Elm.
||
- Boolean or - returns true if at least one input isTrue
.&&
- Boolean and - returns true only if both options areTrue
.not
- Boolean negation - returns the opposite value of the input.xor
- Boolean exclusive-or - returns True if exactly one input isTrue
.
Some programming languages treat the number zero or null
as synonymous with False
. Elm doesn’t allow that, nor does it consider a non-zero value to be True
. For a condition to be true, it must evaluate exactly to the value True
.
Look how helpful the error messages are. It’s one of many reasons why Elm is such a delightful language.