Variables

In PTPScript, Variables are simply represented by names. No prefix characters are required, and the Variable name is case-sensitive.

A valid variable name starts with a letter or an underscore, and is followed by any number of letters, numbers, and underscores. A letter is any character from the standard A-Z alphabet, either upper or lower case, and also a selection of additional characters.

The characters counted as letters, which are valid for variable names, are given below.

ASCII range Characters
65 - 90 ABCDEFGHIJKLMNOPQRSTUVWXYZ
95 _
97 - 122 abcdefghijklmnopqrstuvwxyz
138 Š
140 Œ
142 Ž
154 š
156 œ
158 ž
159 Ÿ
181 µ
192 - 214 ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ
216 - 221 ØÙÚÛÜÝ
223 - 246 ßàáâãäåæçèéêëìíîïðñòóôõö
248 - 253 øùúûüý
255 ÿ

All of the characters shown in the table above are counted as letters. Numbers are the numerals 0 - 9, with ASCII character codes 48 - 57. ASCII codes 0 - 32, and also code 160, are treated as whitespace, and all remaining characters are available for use as operators.

For example:

{ var }
{ Var }
{ VAR }
{ _var }
{ var_ }
{ var2 }
{ var_2 }
{ 2var } Invalid - Variables cannot start with a number
{ _2var }
{ mañana }
{ olé }

Variables in PTPScript are always assigned "by value", rather than "by reference". All this means is that if you say a = b, a will become a copy of b, so that changing one will not affect the other. There is currently no perceived need for references in PTPScript.

Predefined Variables

Generally there will be a host of Variables predefined by the backend programmer. After all, the whole point of a templating system is to enable the frontend designer to manipulate data fed through from the backend. However, PTPScript itself does not predefine any Variables.

Obviously, new Variables can be created in PTPScript, by using the Assignment operators.

Reserved Words

There are some words that cannot be used for Variable names. Commands cannot be used as Variable names, and neither can any alphabetic Operators.

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