ERights Home elang / scalars 
Back to: float64 Type On to: char Type

Scalar Type:
boolean


E's booleans are as you'd expect. There are only two boolean values, known as "true" and "false". Here are the applicable operators in precedence order.

Logical Or (don't-care-associative)

Example Meaning Expansion Value
false || true
Are any true? see *** true

Evaluates left to right until it finds a true condition. If any are true, it returns true and stops evaluating. If all return false, then all are evaluated and the result is false.

Logical And (don't-care-associative)

Example Meaning Expansion Value
false && true
Are all true? see *** false

Evaluates left to right until it finds a false condition. If any are false, it returns false and stops evaluating. If all return true, then all are evaluated and the result is true.

Boolean Comparisons (non-associative)

Example Meaning Expansion Value
false == true
same?
__equalizer.sameEver(false, true)
false
false != true
different?
__equalizer.sameEver(false, true).not()
true
false & true
both?
false.and(true)
false
false | true
either?
false.or(true)
true
false ^ true
exactly one?
false.xor(true)
true

Whereas "&&" and "||" are flow control operators as well as logical operators, "&","|",and "^" are normal operators that always evaluate both their operands.

Unary Expressions (left associative)

Example Meaning Expansion Value
! false
not
false.not()
true

As you'd expect.


Additional boolean Messages

In addition to the messages corresponding to the above operators, booleans respond to the pick(trueChoice, falseChoice) message.

? pragma.syntax("0.8")

? true.pick(3, 5)
# value: 3

? false.pick(3, 5)
# value: 5

In response to the pick message, true will return the trueChoice, and false will return the falseChoice.

 

 
Unless stated otherwise, all text on this page which is either unattributed or by Mark S. Miller is hereby placed in the public domain.
ERights Home elang / scalars 
Back to: float64 Type On to: char Type
Download    FAQ    API    Mail Archive    Donate

report bug (including invalid html)

Golden Key Campaign Blue Ribbon Campaign