Constants in PTPScript are the same as Variables in terms of use, except for a couple of differences. Firstly, they are case-insensitive, and secondly, they are read-only. Apart from that, the naming conventions are the same, and the usage is the same.

As their read-only nature implies, Constants do not change in value. The exception to this rule is "magic" constants, which are used in the same way and have all the same properties but are not actually constants (because their values are not constant).

Constants cannot be created in PTPScript, and so the only ones available will be the ones listed on this page (unless the backend PHP programmer extends PTPScript to add more).

The predefined constants are:

true Boolean true
false Boolean false
pi Pi (i.e. 3.14159 etc. etc.)
e Euler's number, base of natural log (i.e. 2.71828 etc. etc.)

For example:

{ a = true }
{ b = false }
{ c = pi * r**2 }
{ d = e**x }

Magic Constants

So-called "magic" Constants are special values that are important for use, but cannot be changed from PTPScript. PTPScript currently has only two magic Constants: __CurrentLoop__ and __CurrentLoops__. Both are used with Loop commands.

Note that magic Constants are still case-insensitive - they are simply written in TitleCase for clarity.

ptpscript/constants.txt · Last modified: 2007/01/24 10:15
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki