WishWiki

Expression (programming)

An expression is a combination of operations, variables, functions, and literals that evaluates to a single value. Expressions are fundamental units of computation in every programming language, distinct from statements which perform actions without necessarily returning values.

Expressions can be simple—a single number or variable—or complex, combining multiple operations through operators and function calls. The evaluation of an expression follows rules of operator precedence and associativity, ensuring predictable results.

Different paradigms treat expressions distinctly. In functional programming, almost everything is an expression, creating a deeply compositional style. In imperative languages, expressions often sit within broader statements. Some languages blur this line entirely, allowing expressions to stand alone as complete instructions.

The syntax and semantics of expressions vary widely: from postfix notation in some stack languages to infix operators in most mainstream languages. Understanding how expressions compose, evaluate, and interact with program state is essential for writing correct and efficient code.

Related

Operator (mathematics), Function (programming), Statement (programming), Evaluation, Syntax (programming), Functional 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