← All examples

For item type

A loop's item has the list's element type: 'y' is a uint8, so 'y' plus.wrap 10 wraps at 8 bits, and 'x' is an int32 for not.bit.

for_item_type.zg
# A loop's item has the list's element type (found by check claude, 2026-09-29): 'y' is a uint8,
# so 'y' plus.wrap 10 wraps at 8 bits, and 'x' is an int32 for not.bit.
MAIN {
    let 'xs': list[int32] = [1, 2];
    for 'x' in lend 'xs' {
        let 'v': int64 = to.int64['x' plus.wrap 10];
        let 'w': int64 = to.int64[not.bit 'x'];
        std::print.useful['v', " ", 'w', newln];
    }
    let 'ys': list[uint8] = [250, 3];
    for 'i', 'y' in lend 'ys' { std::print.useful['i', " ", 'y' plus.wrap 10, newln]; }
}
Output
11 -2
12 -3
1 4
2 13