Defining Constants#

Constants are helpful to define values that have a special meaning and therefore naming it. Those constants can be of any type (e.g. number, date, boolean) and can be used in any expression instead the direct value. This gives you the possibility to also alter the constant's value in the wiki without altering all the usages of the value.

Defining a constant is identical to defining a direct question assignment, but instead of a predefined question the constant name is to be written left to the expression. The type of the constant is automatically derived by the result of the expression. Note that defining a constant, neither questions nor other constants are allowed to be used in the defining expression. See some examples:

// define a numeric constant
%%Constant pi = 3.14159265358979323846

// define a date constant (see special date notation)
%%Constant bostonTeaParty = #1773-12-16#

// you may also use operators and functions
%%Constant silvesterParty = #1999-12-31# + 19h + 30min
%%Constant pi_of_Archimedes = 3 + 9552/67441

// using other constants is NOT ALLOWED!!! --> error signaled
%%Constant invalidDeclaration = 2*pi

Add new attachment

Only authorized users are allowed to upload new attachments.
This page (revision-3) was last changed on 25-Oct-2013 18:19 by Albrecht Striffler