← All examples

One-ended ranges

A side left out is the type's own limit.

one_ended.zg
# One-ended ranges: a side left out is the type's own limit (owner, 2026-10-12: `int32[min 1]` is
# "at least 1"; until then `min` and `max` named the limits, `int32[1, max]`, 2026-09-23).
MAIN {
    let 'pos': int32[min 1] = 1;
    let 'score': int32[max 100] = 50;
    let 'small': int8[min 1] = 120;
    let 'whole': uint8[min 0, max 255] = 200;          # the whole type: harmless, allowed (owner)
    let 'also': int32 = -7;                             # no bound at all: the type itself
    std::print.useful['pos', " ", 'score', " ", 'small', " ", 'whole', " ", 'also', newln];
}
Output
1 50 120 200 -7