05 Operators and comparisons
Arithmetic computes a value; comparisons and Boolean operators compute Boolean.
norm
main() {
Integer price = 8
Integer quantity = 3
Integer total = price * quantity + 2
Boolean affordable = total <= 30
Boolean available = quantity > 0
printLine(total)
printLine(affordable)
printLine(affordable && available)
}Output:
text
26
true
trueMultiplication binds before addition, so the total is 8 * 3 + 2 = 26. <= and > produce Boolean results. && combines two Boolean values and evaluates its right side only when the left side is true.
Try it: Change quantity to 0 and predict all three output lines before running.
Precise rules: Language Reference.