Renderingen-US

before

Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.

Creates an exclusive range with a Latin keyword.

Syntax: <expression> before <expression>

Category#

range

Examples#

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

Creates an exclusive range with a Latin keyword.

# =============================================================================
# before — Creates an exclusive range with a Latin keyword.
# =============================================================================
#
# What this teaches:
#   • Exclusive range iteration — `range <initium> before <finis>` iterates from
#     initium up to (but not including) finis
#   • Range keyword pattern — `before` provides a natural-language alternative
#     to symbolic range syntax
#
# Common mistakes:
#   • confusing `before` (exclusive upper bound) with `until` (inclusive) — `0 before 4` yields 0,1,2,3 while `0 until 4` yields 0,1,2,3,4
#
# See also: until, ‥
# =============================================================================

# before — exclusive upper bound for range iteration
#
# for range <initium> before <finis> <var> { … }
#
# GRAMMAR:
#   iterStmt :← 'for' 'range' expr 'before' expr binding '{' stmt* '}'
#
# EXPECTED OUTPUT:
#   none

main {
    # i = 0, 1, 2, 3 (stops before 4)
    for range 0 before 4 const i {
        print i
    }
}

Expected output:

0
1
2
3