LESSON 5

Operators

Arithmetic, comparison, logic, membership and ranges stay compact.

Concept

  • Arithmetic: + - * / % **
  • Comparison: == != > >= < <=
  • Logic: and, or, not. Membership: in. Range: ..
  • `**` is right-associative. Precedence from high to low is **, unary -/not, */%, +/-, .., comparisons, ==/!=, and, or.

Example

SE
a = 10
b = 3
say a + b
say a ** 2
say a > b
say a != b
say true and a > b
say 3 in [1, 2, 3]
say 1..5