Renderingen-US

integratio

Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.

Minimal multi-feature happy path across fn, const, if, and print.

Syntax: integratio — multi-feature happy path

Category#

integration

Examples#

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

Minimal multi-feature happy path across fn, const, if, and print.

# =============================================================================
# integratio — Minimal multi-feature happy path across fn, const, if, and print
# =============================================================================
#
# What this teaches:
#   • Minimal multi-feature happy path across fn, const, if, and print.
#   • Related keywords: fn, const, if, print
#
# Common mistakes:
#   • Writing code outside `main` that produces side effects — top-level code runs at module load; prefer `main` for program entry.
#
# See also: fn, const, if, print
# =============================================================================

# integratio — minimal multi-feature happy path
#
# fn name(params) → type { … }
# const _ n ← expr
# if <cond> { … }
# print template with § interpolation
#
# GRAMMAR:
#   funcDecl   :← 'fn' ident '(' params ')' ('→' type)? block
#   condStmt   :← 'if' expr block
#   outputStmt :← 'print' 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