Skip to content
Tristan Hume edited this page Apr 22, 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