العرضar

casu

Translation status: العربية reader-locale proof. Code fences render through the ar pipeline; prose is canonical Latin.

Introduces a branch inside an elige or discerne statement.

Aliases: case

Syntax: casu <expression> <block>

Category#

control-flow

Examples#

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

Introduces a branch inside an elige or discerne statement.

# =============================================================================
# casu — Introduces a branch inside an elige or discerne statement.
# =============================================================================
#
# What this teaches:
#   • Pattern matching arms — `casu <expression> <block>` defines a branch in
#     an `elige` match expression
#   • Default fallback — `ceterum` provides the catch-all branch when no
#     `casu` pattern matches
#
# Common mistakes:
#   • non-exhaustive match without a `ceterum` catchall — every `elige` or `discerne` must cover all possibilities or add a `ceterum` arm
#
# See also: elige, discerne
# =============================================================================

# casu — branch arm in elige or discerne
#
# GRAMMAR:
#   casuClause :← 'casu' expr block
#
# EXPECTED OUTPUT:
#   Scalar stdout smoke (see body).
#
# BACKEND:
#   Cross-ref: elige/elige.fab, discerne/discerne.fab.
#

main {
    const _ code  200
    switch code {
        case 200 {
            print "ok"
        }
        default {
            print "other"
        }
    }
}

Expected output:

ok