A variable is a storage location paired with an associated symbolic name called identifier.
Variables allow you to store and change information.
Below is an example how to use variables.
A variable identifier consists in a valid identifier optionally followed by the
string-type declaration character $,
integer-type declaration character %,
byte-array-type declaration character @,
double-precision floating-point character !,
boolean-type declaration character #,
64 bit integer-type declaration character &
In case where type declaration character is not specified, floating point type will be assumed.
nuBASIC enables both the creation of a variable through simple assignment without an explicit declaration statement and the declaration of a variable specifying its name and characteristics using Dim Statement
A variable exists from the moment that you assign it a value in your code or declare it by using Dim.
Explicit type declaration syntax:
Dim var as String: string-type declaration
Dim var as Integer: nteger-type declaration
Dim var as Double: double-precision floating-point
Dim var as Boolean: boolean-type
Dim var as Long64: 64 bit integer-type declaration
Type deduction is possible by using the keyword Any.
If you want to prevent unwanted modifications to variables that for some reason should not be changed, you have to declare them "const".