範圍
Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant pack; supporting prose may still be English.
Selects numeric range iteration in an 遍歷 loop.
Syntax: 遍歷 範圍 <range> <binding>
Category#
iteration
Related#
Examples#
radix/corpus/ab/ab.fab (canonical · keyword)#
Selects numeric range iteration in an 遍歷 loop.
# =============================================================================
# 範圍 — Selects numeric range iteration in an 遍歷 loop.
# =============================================================================
#
# What this teaches:
# • `遍歷 範圍` bounded range iteration — iterates over a numeric range with
# an optional step
# • Step syntax — the `per <step>` clause controls stride within the range
#
# Common mistakes:
# • using the retired `範圍`/`ubi` collection pipeline DSL; use ordinary collection methods and closures instead
#
# See also: 遍歷, 取自, 從, per, 範圍 pipeline
# =============================================================================
# 範圍 — bounded iteration step
#
# GRAMMAR:
# iteraStmt :← '遍歷' '範圍' expr '‥' expr step? '定值' ident block
#
# EXPECTED OUTPUT:
# Scalar stdout smoke (see body).
#
main {
for range 0‥10 step 2 const i {
print i
}
}Expected output:
0
2
4
6
8