Wheel IDE

Online demo »

Variables

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.

Number type

A number variable can be used for integers and floating point values.

number n

String type

A string value is a number representing the index in a string list contained in the program file.

string n

Array

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]

Record

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

Global scope

When a variable is declared outside of a procedure then it's accessible in the entire scope of the program after the declaration.

#project "Global variable demo"

number n

proc main()
    n = 10
end

Local scope

A variable declared inside a procedure can only be accesed inside that procedure.

#project "Local variable demo"

proc main()
    number n
    n = 10
end

Parameter variables

All procedures except the main procedure can have one or more parameters.

#project "Parameter demo"

proc first(number n)
end

proc second(number i, number j)
end

proc main()
    first(15)
    second(17, 18)
end
See also: Constants(Bit) Constants(Button) Constants(Component/AlertDialog) Constants(Component/Button) Constants(Component/Checkbox) Constants(Component/Circle) Constants(Component/ConfirmDialog) Constants(Component/Dropdown) Constants(Component/EV3Motor) Constants(Component/EV3Sensor) Constants(Component/Form) Constants(Component/Icon) Constants(Component/Image) Constants(Component/Interval) Constants(Component/Label) Constants(Component/ListItems) Constants(Component/LoadingDots) Constants(Component/PUDevice) Constants(Component/Panel) Constants(Component/ProgressBar) Constants(Component/Radio) Constants(Component/Rectangle) Constants(Component/SelectButton) Constants(Component/Slider) Constants(Component/StatusLight) Constants(Component/Tabs) Constants(Component/Text) Constants(Component/TextInput) Constants(Component/Timeout) Constants(Component/Title) Constants(Device) Constants(File) Constants(Light) Constants(Math) Constants(Motor) Constants(PSP) Constants(PoweredUp) Constants(Screen) Constants(Sensor multi) Constants(Sensor) Constants(Sound) Constants(Spike) Constants(Standard) Constants(String) Constants(System) Constants(VM File format) procedures(Bit) procedures(Button) procedures(Component/AlertDialog) procedures(Component/Button) procedures(Component/Checkbox) procedures(Component/Circle) procedures(Component/ConfirmDialog) procedures(Component/Dropdown) procedures(Component/EV3Motor) procedures(Component/EV3Sensor) procedures(Component/Form) procedures(Component/Icon) procedures(Component/Image) procedures(Component/Interval) procedures(Component/Label) procedures(Component/ListItems) procedures(Component/LoadingDots) procedures(Component/PUDevice) procedures(Component/Panel) procedures(Component/ProgressBar) procedures(Component/Radio) procedures(Component/Rectangle) procedures(Component/SelectButton) procedures(Component/Slider) procedures(Component/StatusLight) procedures(Component/Tabs) procedures(Component/Text) procedures(Component/TextInput) procedures(Component/Timeout) procedures(Component/Title) procedures(Device) procedures(File) procedures(Light) procedures(Math) procedures(Motor) procedures(PSP) procedures(PoweredUp) procedures(Procedures) procedures(Screen) procedures(Sensor multi) procedures(Sensor) procedures(Sound) procedures(Spike) procedures(Standard) procedures(String) procedures(System) syntax(Syntax)