Associativity

Binary operators whose first character is ^ are right-associative, all other binary operators are left-associative.

  1. proc `^/`(x, y: float): float =
  2. # a right-associative division operator
  3. result = x / y
  4. echo 12 ^/ 4 ^/ 8 # 24.0 (4 / 8 = 0.5, then 12 / 0.5 = 24.0)
  5. echo 12 / 4 / 8 # 0.375 (12 / 4 = 3.0, then 3 / 8 = 0.375)