Content deleted Content added
No edit summary |
m WP:CHECKWIKI error fixes + general fixes using AWB (7507) |
||
Line 1:
An '''expression''' in a [[programming language]] is a combination of explicit [[value (computer science)|value]]s, [[Constant (programming)|constants]], [[variable (programming)|variable]]s, [[operator (programming)|operator]]s, and [[function (programming)|function]]s that are interpreted according to the particular [[Order of operations|rules of precedence]] and of association for a particular programming language, which computes and then produces (''returns'', in a [[state (computer science)|stateful]] environment) another value. This process, like for [[mathematical expression]]s, is called evaluation. The value can be of various [[Data type|type]]s, such as numerical, string, and logical.
For example, 2+3 is an arithmetic and programming expression which evaluates to 5. A variable is an expression because it is a pointer to a value in memory, so y+6 is an expression. An example of a relational expression is 4==4 which evaluates to true.<ref>
In [[C (programming language)|C]] and most C-derived languages, a call to a function with a [[Void type|void]] return type is a valid expression, of type void.<ref>
A function, and hence an expression containing a function, may have [[Side effect (computer science)|side effect]]s. An expression with side effects does not normally have the property of [[referential transparency (computer science)|referential transparency]]. In many languages (e.g. C++) statements may be ended with a semicolon ';' to turn the expression into an expression [[Statement (programming)|statement]]. This asks the implementation to evaluate the expression for its side-effects only, and disregard the result of the expression.
Line 19:
* {{foldoc|Expression}}
{{DEFAULTSORT:Expression (Programming)}}
[[Category:Evaluation]]
[[Category:Programming constructs]]
|