|
Variables must be declared before they are used. Unique names are used to identify variables. Descriptions of
variables are used for them to be defined and for types to be declared. Description is not an operator.
The basic types are:
- bool - boolean values of true and false;
- string - character strings;
- double - double-precision numbers with floating point.
Examples:
string MessageBox;
int Orders;
double SymbolPrice;
bool bLog;
Additional types:
- color is an integer representing an RGB color;
- datetime is date and time, an unsigned integer containing seconds that
have passed since 0.00 a.m. on 1 January, 1970.
Additional data types make sense only at the declaration of input parameters for their more convenient
representation in the properties window.
Example:
datetime tBegin_Data = D'2004.01.01 00:00';
color cModify_Color = C'0x44,0xB9,0xE6';
Arrays
Array is the indexed sequence of the identical-type data.
int a[50]; // A one-dimensional array of 50 integers.
double m[7][50]; // Two-dimensional array of seven arrays,
//each of them consisting of 50 integers.
Only an integer can be an array index. No more than four-dimensional arrays
are allowed. Numbering of array elements starts with 0. The last element of a one-dimensional array has the number which is
1 less than the array size. This means that call for the last element of an array consisting of 50 integers will appear as
a[49]. The same concerns multidimensional arrays: A dimension is indexed from 0 to the dimension size-1.
The last element of a two-dimensional array from the example will appear as m[6][49].
If there is an attempt to access out of the array range, the executing subsystem will generate error named
ERR_ARRAY_INDEX_OUT_OF_RANGE that can be got using the GetLastError() function.
|