type var
type[scope][ptr][&] var[(expression)] [var2[(expression)] ...] [= expression]
type - variable type name.
var - variable name.
scope - variable storage and scope. Can be one of symbols listed below. Default: var is local.
+ | var is global variable. |
- | var is thread variable, shared by all functions of current thread. |
-- | var is thread variable, private to current function. |
ptr - up to three * characters used to declare pointer variable.
& - declare reference variable.
expression - initial value. Default: 0 or empty.
Creates one or several variables.
For ARRAY variables, also must be specified array type (type of elements): ARRAY(type) var
Member functions can be called inside declaration statement: type var.member(args)
Local variables can be declared inline, using syntax type'var. See example with for.
int a ;;declare local variable a of type int byte b c d ;;declare 3 local variables b, c and d of type byte int i = 5 ;;declare local variable i of type int; i=5 int e(10) f(20) ;;declare 2 local variables e and f of type int; e=10; f=20 int+ hwnd = win("Notepad") ;;declare global variable hwnd of type int; hwnd=win("Notepad") double d1 ;;declare local variable d1 of type double double d2 = d1 + (0.45 * i) ;;declare local variable d2 of type double; d2 = d1 + (0.45 * i) str S1 = "Little Alien" ;;declare local variable S1 of type str; S1="Little Alien" str S2.from("Little " "Alien") ;;declare local variable S2 of type str; S2.from("Little " "Alien") str* sp = &S1 ;;declare local variable sp of type str* (pointer to variable of type str); sp=&S1 (sp is address of S1) str& sr = &S2 ;;declare local variable sr of type str& (reference to variable of type str); sr is reference to (alias of) S2 str& sr = S2 ;;the same (& may be omitted) str*& spr = &sp ;;declare local variable spr of type str*&; spr is reference to sp str** spp = &sp ;;declare local variable spp of type str** (pointer to pointer to variable of type str); spp=&sp (spp is address of sp) str*** sppp = &spp ;;declare local variable sppp of type str*** (pointer to pointer to pointer to variable of type str); sppp=&spp (sppp is address of spp) POINT point ;;declare local variable point of user-defined type POINT function word'w int**i str&s ;;declare function parameters (local variables w, i and s) for(int'j 0 len(S1)) out S1[j] ;;here j is declared inline. Same as int j; for(j 0 len(S1)) out S1[j] inp str's ;;same as str s; inp s ARRAY(str) a.create(10) ;;create local safe array of 10 elements of type str Excel.Application b._create ;;create object of type Excel.Application (type Application is declared in Excel type library)