渲染zh-Hant

integratio

Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant 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