About
An Expression is a suite of special token that:
- are contained in statements
ie:
- It's a piece of language that can be evaluated/executed.
- Evaluating an expression produces a value
- The content of a language script file is an expression.
They are a value specifications that specify values resulting from a computation.
The expression execution order is determined by control-flow statements like if and for.
An expression is any reference to a variable or value, or a set of variable( s) and value( s) combined with operators.
Component
The following token compose an expression:
List
- Mathematics Expression
- …
- expression statement: a general expression that stands alone, generally it's used as a call expression statement to call a Function.
Example
a = b * 2;
This statement has four expressions in it:
- 2 is a literal value expression.
- b is a variable expression, which means to retrieve its current value.
- b * 2 is an arithmetic expression, which means to do the multiplication.
- a = b * 2 is an assignment expression, which means to assign the result of the b * 2 expression to the variable a.
Documentation / Reference
- Unified Modeling Language (UML) - 2.5.1 - chapter 8.3