Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

iter

std › iter

Stepped ranges of integers, for @for.

from std.iter import range

macro countdown() {
    @for i in range(10, 0, -3) {
        @emit i
    }
}

countdown
10 7 4 1

Macros

range

A Range from start to stop, not including stop, every step.

SyntaxParametersResultDescription
range start, stop, stepstart: int, stop: int, step: int = 1

Types

Range

struct Range<const start: int, const stop: int, const step: int>

The integers from start up to (or down to) stop, not including it, every step. range builds one. step can’t be 0, and has to point from start towards stop.

Some of its fields are generated by @for or @if.