There are five built-in types, which allow you to store integers (whole numbers in three different ranges), floating point numbers (numbers with fractional parts or very large numbers) and strings (sequences of letters, numbers or any other character). You define a variable and its type by either:
| Type | Extension | Use | Range |
|---|---|---|---|
| Byte | b | Small whole numbers | -128 to +127 |
| Word | w | Medium sized whole numbers | -32768 to +32767 |
| Long | l (lower case 'L') | Large whole numbers | -2147483648 to +2147483647 |
| Float | f | Numbers with fractional parts or very large numbers | |
| String | s | Sequences of letters, digits or other characters (e.g. an address) | Up to 65536 characters |
You cannot change the type of a variable once it has been defined. The compiler will give you an error if you try to do this.
As an alternative for string variables you can use the dollar symbol ($) to indicate that it is a string. If you do this you must always use the dollar symbol after the variable name. You should not put a full stop between the variable name and the dollar symbol.
| Previous topic | Chapter contents | Next topic |
|---|---|---|
| What are variables? | User Guide contents | Creating variables |