TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
= operator in Kotlin is the fundamental assignment operator. It binds the evaluated result of a right-hand side (RHS) expression to a left-hand side (LHS) identifier, establishing either an initial reference in memory or updating an existing mutable reference.
Technical Characteristics
Statement, Not an Expression Unlike languages such as Java or C, the= operator in Kotlin is a statement, not an expression. It does not evaluate to or return a value. Consequently, chained assignments are syntactically invalid and will result in a compilation error.
= operator based on the LHS declaration:
val(Read-only): The=operator acts strictly as an initializer. It can only be applied once to bind the initial reference. Subsequent applications result in aVal cannot be reassignedcompilation error.var(Mutable): The=operator acts as both an initializer and a reassignment operator, allowing the LHS identifier to point to new memory addresses or primitive values throughout its lifecycle.
= operator are prohibited.
= operator cannot be overloaded. It is a hardcoded language construct. However, compound assignment operators that incorporate = (such as +=, -=, *=) can be overloaded by implementing their corresponding Assign functions (e.g., plusAssign, minusAssign) on the target class.
Master Kotlin with Deep Grasping Methodology!Learn More





