The wheel VM only uses one primitive data type: number.
Wheel supports three other data types: string, record, array and pointer.
These types are all based on the primitive number type.
A variable is declared by the type followed by the name of the variable.
A number variable can be used for integers and floating point values.
number n
A string value is a number representing the index in a string list contained in the program file.
string n
An array represents a list. Arrays can be declared by defining the size between brackets after the variable name. The size must a positive number of at least 1 or higher.
number n[10]
A record is a representation of a group of variables.
record Point number x number y endr Point p proc main() p.x = 10 p.y = 5 end
When a variable is declared outside of a procedure then it's accessible in the entire scope of the program after the declaration.
"Global variable demo" number n proc main() n = 10 end
A variable declared inside a procedure can only be accesed inside that procedure.
"Local variable demo" proc main() number n n = 10 end
All procedures except the main procedure can have one or more parameters.
"Parameter demo" proc first(number n) end proc second(number i, number j) end proc main() first(15) second(17, 18) end