Variables are area of your computers memory that you can use to store data that must change while your program executes
Variables are accessed using their names. Variable names can consist of letters (A-Z, a-z), numbers (0-9) and the underscore character (_) and are case insensitive.
Every variable has a type which determines what can be stored in it. The five basic types in PureBasic are byte, word, long, float and string.
The type is specified in the variable name extension or after the DefType keyword. You only need to specify the type the first time you use a variable. The exception to this is when you use the dollar symbol for a string variable - in this case you must always use the dollar symbol.
You cannot change the type of a variable once it has been created.
The DefType keyword can be used to create one or more variables or to change the default type (if no variables are created).
Any variables created without a type will use the default type. This is long unless you change it with the DefType keyword.
| Previous topic | Chapter contents | Next topic |
|---|---|---|
| Creating variables | User Guide contents | None |