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

integratio

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

Minimal multi-feature happy path across ฟังก์ชัน, คงที่, ถ้า, and บันทึก.

Syntax: integratio — multi-feature happy path

Category#

integration

Examples#

radix/corpus/integratio/minimum-smoke.fab (canonical · concept)#

Minimal multi-feature happy path across ฟังก์ชัน, คงที่, ถ้า, and บันทึก.

# =============================================================================
# integratio — Minimal multi-feature happy path across ฟังก์ชัน, คงที่, ถ้า, and บันทึก
# =============================================================================
#
# What this teaches:
#   • Minimal multi-feature happy path across ฟังก์ชัน, คงที่, ถ้า, and บันทึก.
#   • Related keywords: ฟังก์ชัน, คงที่, ถ้า, บันทึก
#
# Common mistakes:
#   • Writing code outside `เริ่ม` that produces side effects — top-level code runs at module load; prefer `เริ่ม` for program entry.
#
# See also: ฟังก์ชัน, คงที่, ถ้า, บันทึก
# =============================================================================

# integratio — minimal multi-feature happy path
#
# ฟังก์ชัน name(params) → type { … }
# คงที่ _ n ← expr
# ถ้า <cond> { … }
# บันทึก template with § interpolation
#
# GRAMMAR:
#   funcDecl   :← 'ฟังก์ชัน' ident '(' params ')' ('→' type)? block
#   condStmt   :← 'ถ้า' expr block
#   outputStmt :← 'บันทึก' expr
#
# EXPECTED OUTPUT:
#   minimum-smoke.expected — par 42 when n is even.

fn par(int n) → bool {
    return n % 2 ≡ 0
}

main {
    const int n ← 42
    if par(n) {
        print "par §"(n)
    }
}

Expected output:

par 42