← All examples

The operators are words

plus, minus, times, and .wrap for the wrapping ones; a negative keeps -.

word_operators.zg
# The operators are words (owner, 2026-10-02/03): `plus`, `minus`, `times`, and `.wrap` for the
# wrapping ones; a negative keeps `-`. The power is std's `pow` (bare or `std::pow`), which has no
# precedence yet, so it is bracketed beside another operator.
MAIN {
    let 'a': int32 = 7;
    let 'b': int32 = 3;
    std::print.useful[('a' plus 'b'), " ", ('a' minus 'b'), " ", ('a' times 'b'), " ", ('a' pow 'b'), " ", ('a' std::pow 2), " ", -'a', newln];
    let 'h': uint8 = 200;
    std::print.useful[('h' plus.wrap 100), " ", ('h' times.wrap 2), " ", ('h' pow.wrap 2), newln];
    std::print.useful[(2 pow 3) plus 1, " ", 1 plus 2 times 3, newln];
}
Output
10 4 21 343 49 -7
44 144 64
9 7