Skip to content
Tristan Hume edited this page Apr 23, 2012 · 3 revisions

#explicitConstant

##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.html, explicitintegerconstant.html, explicitrealconstant.html, explicittruefalseconstant.html and explicitcharconstant.html. See also enumeratedvalue.html.

Clone this wiki locally