WishWiki

Assignment (programming)

In programming, assignment is the fundamental operation of storing a value in a variable or data structure. When a program executes an assignment statement, it evaluates an expression on the right side and binds the result to a name on the left—a core act that transforms program state.

Most languages use the = symbol, though Syntax varies: some require explicit type declarations, others infer types automatically. Assignment underlies nearly every computation: updating loop counters, storing function results, modifying data structures like arrays and dictionaries.

Assignment differs subtly from mathematical equality. In math, x = 5 states a fact; in code, it's an instruction that makes x hold 5. This distinction reflects imperative programming's model of sequential state change.

Some languages blur this line through immutability—favoring functional styles where values never change, only new ones are created. Others support multiple assignment (unpacking) or compound operators like += that combine Arithmetic and assignment.

Assignment is so basic it often goes unexamined, yet it shapes how programmers think about logic and algorithms.

Related

Variable (programming), Expression (programming), Imperative programming, Functional programming, Scope (programming)

Wishing…
your wish is being written

✨ Wish for a new page

👁 Wish for another view of this page

Sign in to WishWiki

Keep your wishes together, see your activity — and later, get your own private wiki space.

⏱ Page history