العرضar

ليكن

Translation status: العربية reader-locale proof. Term names and code fences follow the ar pack; supporting prose may still be English.

Declares an inferred immutable local.

Syntax: ليكن <name> [← <expression>]

Category#

binding

Examples#

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

Declares an inferred immutable local.

# =============================================================================
# ليكن — Declares an inferred immutable local.
# =============================================================================
#
# What this teaches:
#   • Immutable binding sugar — `ليكن name` is a compact alternative to
#     `ثابت _ name` for inferred-type immutable locals
#   • Supports immediate init (`ليكن x ← expr`) and deferred init
#     (`ليكن x` then `x ← expr` later)
#
# Common mistakes:
#   • Confusing `ليكن` (sugar for `ثابت _`) with `متغير` — `ليكن` creates an immutable binding.
#
# See also: ثابت, متغير, ←
# =============================================================================



# ليكن — inferred immutable bindings
#
# Immediate init:
#   ليكن اسم ← expr        -- compact sugar for ثابت _ اسم ← expr
#
# Deferred init:
#   ليكن اسم               -- compact sugar for ثابت _ اسم (assign once later)
#   اسم ← expr
#
# Prefer ليكن when a block chains several inferred locals; keep ثابت _ when
# teaching the explicit infer marker or mixing typed and inferred bindings.
#
# GRAMMAR:
#   sitDecl := 'ليكن' IDENTIFIER ('←' expression)?
#
# EXPECTED OUTPUT:
#   sit.expected

main {
    let salve ← "Salve"
    let اسم ← "Marcus"
    let nuntius ← "§, §!"(salve, اسم)

    print nuntius

    let label
    label ← "deferred"
    print label

    const _ idem ← nuntius
    print idem
}

Expected output:

Salve, Marcus!
deferred
Salve, Marcus!