चर
Translation status: हिन्दी reader-locale proof. Term names and code fences follow the hi pack; supporting prose may still be English.
Declares a mutable binding.
Aliases: let, mutable
Syntax: चर <type|_> <pattern> [← <expression>]
Category#
binding
Related#
Examples#
radix/corpus/varia/varia.fab (canonical · keyword)#
Declares a mutable binding.
# =============================================================================
# चर — Declares a mutable binding.
# =============================================================================
#
# What this teaches:
# • Mutable bindings — `चर` for values that can be reassigned after declaration
# • Immutable bindings — `स्थिर` and `बैठा` for values that cannot be reassigned
#
# Common mistakes:
# • declaring चर when the binding is never reassigned — use स्थिर instead (WARN013)
#
# See also: स्थिर, ←, ↑
# =============================================================================
# Mutable and immutable variable declarations
#
# चर <नाम> ← <expr> -- mutable binding (may reassign)
# स्थिर <नाम> ← <expr> -- immutable binding (see स्थिर/fixum.fab)
#
# GRAMMAR:
# bindingStmt :← ('चर' | 'स्थिर') type? ident '←' expr
#
# EXPECTED OUTPUT:
# 0, 1, 11, "Salve, Mundus!", 30, "Vale"
main {
# --- Mutable bindings with चर ---
var _ computus ← 0
print computus
computus ← 1
print computus
computus ← computus + 10
print computus
# --- Immutable bindings: स्थिर _ and बैठा ---
const _ salutatio ← "Salve, Mundus!"
print salutatio
# बैठा compresses repeated स्थिर _ when chaining inferred locals
let x ← 10
let y ← 20
let योग ← x + y
print योग
# --- Reassign only चर bindings ---
var _ nuntius ← "Salve"
nuntius ← "Vale"
print nuntius
}Expected output:
0
1
11
Salve, Mundus!
30
Vale