1.7 // a numeric literal "Oh no! We're out of coffee!" // a string literal true // a Boolean literal null // the literal null value i // the variable i sum // the variable sum
The value of a constant expression is simply the constant itself. The value of a variable expression is the value that the variable refers to.
These expressions are not particularly interesting. More complex (and interesting) expressions can be created by combining simple expressions. For example, we saw that 1.7 is an expression and i is an expression, so the following is also an expression:
i + 1.7
(i + 1.7) - sum