स्थैतिक
Translation status: हिन्दी reader-locale proof. Term names and code fences follow the hi pack; supporting prose may still be English.
Marks a class member as belonging to the type itself.
Syntax: स्थैतिक <type> <name> [= <expression>]
Category#
type
Related#
Examples#
radix/corpus/generis/generis.fab (canonical · keyword)#
Marks a class member as belonging to the type itself.
# =============================================================================
# स्थैतिक — Marks a class member as belonging to the type itself
# =============================================================================
#
# What this teaches:
# • Marks a class member as belonging to the type itself.
# • Related keywords: वर्ग, ego
#
# Common mistakes:
# • Accessing a `स्थैतिक` field on an instance instead of the type — `स्थैतिक` fields are static members accessed via the वर्ग name, not via `ego`.
#
# See also: वर्ग, ego
# =============================================================================
# स्थैतिक marks a static वर्ग field (shared across instances)
#
# स्थैतिक <type> <field> = <initium> -- class-level binding, not per-instance
#
# GRAMMAR:
# fieldDecl inside genusDecl :← 'स्थैतिक'? type ident ('=' expr)?
#
# EXPECTED OUTPUT:
# ruber
#
# Instance field `नाम` is per-object; `स्थैतिक ruber` would be accessed on the
# वर्ग type in full programs (here only instance fields are read).
class Color {
static string ruber = "#ff0000"
var string नाम = "ruber"
}
main {
const Color color ← Color {}
print color.nomen
}Expected output:
ruber