Renderingen-US

per

Translation status: English reader-locale proof. Code fences render through the en pipeline; prose is canonical Latin.

Sets the step for a range.

Syntax: <range> per <expression>

Category#

range

Examples#

radix/corpus/per/per.fab (canonical · keyword)#

Sets the step for a range.

# =============================================================================
# per — Sets the step for a range.
# =============================================================================
#
# What this teaches:
#   • Range stepping — `per <expr>` after a range specifies the increment between iterations.
#   • Custom step sizes — Unlike the default step of 1, `per 2` iterates over even numbers only.
#
# Common mistakes:
#   • Confusing `per` (range step) with `perge` (continue) — they are unrelated keywords.
#
# See also: ante, usque
# =============================================================================

# per — step size for range iteration
#
# itera ab <initium>‥<finis> per <gradus> <var> { … }   -- half-open range step
#
# GRAMMAR:
#   iterStmt :← 'itera' 'ab' expr '‥' expr 'per' expr binding block
#
# EXPECTED OUTPUT:
#   0, 2, 4, 6 (step by 2 over 0‥8).

main {
    # i = 0, 2, 4, 6 (step by 2)
    for range 08 step 2 const i {
        print i
    }
}

Expected output:

0
2
4
6