Expression statements can produce a result.
Facts about expression statements are as follows:
- Empty expressions are permitted.
- All statements must terminate with a semicolon.
Several examples are provided below.
The following example sums two values and assigns the result to a variable named z.
The following example calculates the square root of 9 and assigns the result to a variable named x.
The following example calls a hypothetical function named SetName.
The following example is a statement with an empty expression.