
Chapter 12 Device Logic (Pawn)
12.5.1.6 Numerical constants
12.5.1.6.1 Numerical integer constants
Binary
0b followed by a series of 0 and 1
Decimal
A series of numbers between 0 and 9
Hexadecimal
0x followed by a series of numbers between 0 and 9 and the letters a to f
12.5.1.6.2 Numerical floating-point constants
A floating-point number is a number with numbers after the decimal point. A floating-point number starts with
one or several numbers, includes a decimal point and has at least one number after the decimal point, e.g.
"12.0" and "0.75" are valid floating-point numbers. An exponent can optionally be added. The notation is the
letter "e" (lower case) followed by an integer numerical constant. For example, "3.12e4" or "12.3e-3" are valid
floating-point numbers with an exponent.
12.5.2 Variables
12.5.2.1 Declaration
The keyword "new" declares a new variable. For special declarations, the keyword "new" is replaced with
"static" (see "Static local declaration" on page 166). The value of the new variable is zero, provided that is not
initialised explicitly.
A variable declaration can appear
l
At every position at which an expression is valid - local variable
l
At every position at which a function declaration or the implementation of the function is valid - global
variables
l
In the first expression of a "for" loop (see "For (expression 1; expression 2; expression 3) statement " on
page 176) - local variable
Example:
new a;
// without initialisation (value is 0)
new b = 3; // with initialisation (value is 3)
12.5.2.2 Local declaration
A local declaration appears within a statement block. A variable can only be accessed within this block and
the blocks that it comprises. A declaration within the first expression of a loop instruction is also a local
declaration.
12.5.2.3 Global declaration
A global declaration appears outside of a function and a global variable can be used in any function. Global
variables can only be initialised with constant expressions.
Rev. 01
165