| Syntax |
An explicitConstant is one of:
| | (a) | explicitStringConstant | | % e.g.: "Hello world" |
| | (b) | explicitIntegerConstant | | % e.g.: 25 |
| | (c) | explicitRealConstant | | % e.g.: 51.8 |
| | (d) | explicitTrueFalseConstant % e.g.: true |
| | (e) | explicitCharConstant | | % e.g.: 'Hi' |
|
| Description |
An explicitConstant gives its value directly. For example, the value of the explicit constant 25 is twenty-five.
|
| Example |
In the following, the explicit constants are "Hello world", 3.14159 and 2. Note that pi is a named constant rather than an explicit constant.
put "Hello world"
var diameter : real
const pi := 3.14159
diameter := pi * r ** 2
var x := diameter
|
| Details |
In some programming languages, explicit constants are called literals or literal values, because they literally (explicitly) give their values.
|
| See also |
explicitStringConstant, explicitIntegerConstant, explicitRealConstant, explicitTrueFalseConstant and explicitCharConstant. See also enumeratedValue.
|