การเรนเดอร์th-TH

‥

Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH pack; supporting prose may still be English.

Half-open and inclusive range endpoints in วน ช่วง and ∈.

Syntax: <expression> ‥ <expression> | <expression> … <expression>

Category#

range

Examples#

radix/corpus/operatores/range-glyphs.fab (canonical · operator-group)#

Half-open and inclusive range endpoints in วน ช่วง and ∈.

# =============================================================================
# ‥ — Half-open and inclusive range endpoints in วน ช่วง and ∈.
# =============================================================================
#
# What this teaches:
#   • Exclusive ranges — `‥` (two dots) creates half-open ranges: start inclusive, end exclusive.
#   • Inclusive ranges — `…` (three dots) creates inclusive ranges: both endpoints included.
#
# Common mistakes:
#   • Confusing ‥ (exclusive range) with … (inclusive range) — off-by-one errors are the most common range bug.
#
# See also: ‥, …, ก่อน, จนถึง, ∈
# =============================================================================

# operatores/range-glyphs — ‥ (exclusive) and … (inclusive)
#
# GRAMMAR:
#   rangeExpr :← expr ('‥' | '…') expr
#
# EXPECTED OUTPUT:
#   0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5
#
# BACKEND:
#   Cross-ref วน/intervallum.fab and operatores/membership-range.fab.

main {
    var int exclusivus ← 0
    for range 0‥5 const _ {
        exclusivus ↑
    }
    # 5 iterations
    print exclusivus
    var int inclusivus ← 0
    for range 0…5 const _ {
        inclusivus ↑
    }
    # 6 iterations
    print inclusivus
}

Expected output:

5
6