Data types and variables
In OWBasic there are variables of the types integer, float, boolean, character and string. The standard type is integer. This default can be modified with the keyword DEFAULT in the program.
The type of variables can specified with a suffix. This way one can create variables of other types than the default type. Additionally to the built-in types user-defined types which are declared by ENUM or FPTR can be used; they are given by the '\' operator and the type name.
If a variable was used once, then the first time used type becomes the standard type for this variable.
Note: This rule was created, in order to abbreviate the work. Suffixes to the variables are not necessary thereby after the variable was used once.
On the other hand this is error-prone with imprudent use. If for example one assumes a variable to have the default type, but an previous use has changed this, then difficult to find errors may occur. The situation becomes still obscurer, if two variables with the same names but different types exist. Here the first used variable decides about the used type.
Example:
alpha=4
beta#=5
alpha#=3.14
PRINT alpha : ! alpha is the integer variable of the line 1
PRINT alpha# : ! alpha# is the floating variable of the line 3
PRINT beta : ! beta is the floating variable of the line 2 |
The global constants and variables available in OWBasic can be found at GLOBAL .
|