रेंडरिंगhi

स्थिति

Translation status: हिन्दी reader-locale proof. Term names and code fences follow the hi pack; supporting prose may still be English.

Introduces a branch inside an चुनो or मिलाओ statement.

Aliases: case

Syntax: स्थिति <expression> <block>

Category#

control-flow

Examples#

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

Introduces a branch inside an चुनो or मिलाओ statement.

# =============================================================================
# स्थिति — Introduces a branch inside an चुनो or मिलाओ statement.
# =============================================================================
#
# What this teaches:
#   • Pattern matching arms — `स्थिति <expression> <block>` defines a branch in
#     an `चुनो` match expression
#   • Default fallback — `अन्यतम` provides the catch-all branch when no
#     `स्थिति` pattern matches
#
# Common mistakes:
#   • non-exhaustive match without a `अन्यतम` catchall — every `चुनो` or `मिलाओ` must cover all possibilities or add a `अन्यतम` arm
#
# See also: चुनो, मिलाओ
# =============================================================================

# स्थिति — branch arm in चुनो or मिलाओ
#
# GRAMMAR:
#   casuClause :← 'स्थिति' expr block
#
# EXPECTED OUTPUT:
#   Scalar stdout smoke (see body).
#
# BACKEND:
#   Cross-ref: चुनो/elige.fab, मिलाओ/discerne.fab.
#

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

Expected output:

ok