mặc_định
Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.
Starts the default branch of an chọn or phân_tích statement.
Aliases: default
Syntax: mặc_định <block>
Category#
control-flow
Related#
Examples#
radix/corpus/ceterum/ceterum.fab (canonical · keyword)#
Starts the default branch of an chọn or phân_tích statement.
# =============================================================================
# mặc_định — Starts the default branch of an chọn or phân_tích statement.
# =============================================================================
#
# What this teaches:
# • Default arm — `mặc_định <block>` is the catch-all branch in an `chọn`
# or `phân_tích` match expression
# • Fallback handling — when no `trường_hợp` pattern matches, execution falls
# through to the `mặc_định` block
#
# Common mistakes:
# • using `mặc_định` with `phân_tích tất_cả` — `tất_cả` forbids catchall arms and requires listing every variant explicitly (SEM044)
#
# See also: chọn, phân_tích
# =============================================================================
# mặc_định — default chọn arm
#
# GRAMMAR:
# defaultClause :← 'mặc_định' block
#
# EXPECTED OUTPUT:
# Scalar stdout smoke (see body).
#
# BACKEND:
# Cross-ref: chọn/ceterum.fab.
#
main {
const _ nhãn ← "z"
switch nhãn {
case "a" { print "a" }
default { print "default" }
}
}Expected output:
default