www.riscos.com Technical Support: |
|
There are three different types of variables used to store different types of information. These are:
Each type is distinguished by the last character of the variable name. A name by itself, like Fred, signifies a floating point variable; Fred% is an integer variable, and Fred$ is a string variable.
The rules for naming variables are as follows:
All the following names are allowed:
X xpos XPOS Xpos x_position greatest_x_position position_of_X XPOS1
Note that upper- and lower-case letters are regarded by BASIC as being different, so that XPOS, xpos and Xpos are three separate variables.
The following names are not allowed:
2pos | It does not begin with a letter. |
TOTAL_x | It begins with TO, a BASIC keyword. |
FOREST | It begins with FOR, a BASIC keyword. |
COST | It begins with COS, a BASIC keyword. |
x-pos | It contains a minus sign. |
X Position | It contains a space. |
X.pos | It contains a punctuation mark. |
It is very easy to be caught out by the rule which says that the variables must not start with a BASIC keyword. The best way to avoid this problem is to use lower- or mixed-case variable names since BASIC keywords only use upper-case. This has the added advantage of making the program easier to read.
The values of the current variables may be displayed at any time by typing the command LVAR at the BASIC prompt and then pressing Return.