Expressions

PTPScript code is built completely from expressions. An expression is a combination of Numbers, Strings, Operators (including grouping symbols such as brackets/parentheses), Variables, Constants, and Functions. These terms are evaluated according to Operator precedence and association rules, in order to return a value.

Anything within Placeholders is considered to be an expression of some sort. Placeholders will always display the result of evaluating the expression they contain (although sometimes the effective result will be nothing, such as when using a Comment or a Command).

For example:

{ 3 }

3

The example shown above is the simplest form of expression possible. The expression has one term - the number 3. Nothing is done to the number, so it will be displayed as-is.

Expressions are usually more complex.

For example:

{ 12 + 5 * (4 + 3.2**3) / 8 }

34.98

The above example demonstrates a purely mathematical expression. Note that due to Operator precedence, the expression is not evaluated purely from left to right, but rather, Operators having higher priority are evaluated first.

ptpscript/expressions.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