渲染zh-Hant

直到

Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant pack; supporting prose may still be English.

Creates an inclusive range with a Latin keyword.

Syntax: <expression> 直到 <expression>

Category#

range

Examples#

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

Creates an inclusive range with a Latin keyword.

# =============================================================================
# 直到 — Creates an inclusive range with a Latin keyword.
# =============================================================================
#
# What this teaches:
#   • Inclusive range — `範圍 <initium> 直到 <finis>` iterates including both endpoints
#   • Range iteration — combining `遍歷` with `直到` for bounded loops
#
# Common mistakes:
#   • confusing 直到 (inclusive range bound) with 當 (loop) or 區間 (range type)
#
# See also: 之前, …
# =============================================================================




# 直到 — inclusive upper bound for range iteration
#
# 遍歷 範圍 <initium> 直到 <finis> <var> { … }   -- both endpoints included
#
# GRAMMAR:
#   iterStmt :← '遍歷' '範圍' expr '直到' expr binding block
#
# EXPECTED OUTPUT:
#   0, 1, 2, 3 (inclusive range through finis).

main {
    # i = 0, 1, 2, 3 (includes 3)
    for range 0 until 3 const i {
        print i
    }
}

Expected output:

0
1
2
3