$VARIABLE
- Last UpdatedJan 05, 2026
- 1 minute read
Syntax
$VARIABLE (CHAR ! NUM) ( Variable < [ Dimension ] > ... )
Declares one or more variable to be of the given type. Note that this command only declares the variables and they cannot be used until they have been given a value by the $SET or $DEFAULT commands. A type code must be supplied with the variable and this should be one of the following:
CHAR for character variables
NUM for numeric variable, no distinction is made between Integer and Real
|
for example, |
$VARIABLE NUM x1 x2 y1 y2 $VARIABLE CHAR name1 name2 |
Note:
All variables(except parameters to macros) are global and therefore can be used at
any time.
To use a variable within an INTERFACE command the user should supply the name of the variable
|
for example, |
$SET area width*height $IF area > max-area THEN $GOTO %too-big $PRINT "AREA ",area," IS LARGER THEN MAXIMUM ALLOWED ",max-area. |
To use a variable as part of an APPLICATION command it must be placed within single quotes.
|
for example, |
GET SECTION 'curve-pos' |
Arrays can be defined using '[ Dimension ]' option. The Dimension of the array must be a positive whole number. The array indexes will be 1, 2, 3, .... , Dimension.
|
for example, |
$VARIABLE count myarray[10] $DO count; 1 ; 10 $SET myarray[count] count*count $ENDDO |