Copyright © 2024 Sebastiaan Heins
make is used to create a new variable.
make is followed by the type of the variable, the name of the variable and the value of the variable.
make int number = 5
This creates a new variable called number
with the value 5
.
The type of the variable is int
.
The type of the variable is set when the variable is created and cannot be changed.
The type of the variable is used to determine what operations can be performed on the variable and what data is stored.
Here are a few examples of valid variable declarations:
make int number = 5
make float floatNum = 5.5F
make string name = "Robotnik"
make bool valid = true
You can see there's quite a few types.
To get a list of all types, go to 2.1 Types.
If you want to use the var type explicitly (a generic type that can store any type of data), you can also not specify a type.
make value = 10 // 10
set value = "Hello!" // OK
set is used to set an existing variable to a new value.
set is followed by the name of the variable and the new value of the variable. Seperated by an assigment operator
Here's an example:
make int number = 5
set number = 10 // number is now 10
You can also use other assigment operators.
make int number = 5
set number += 10 // number is now 15
set number -= 5 // number is now 10
set number *= 2 // number is now 20
set number /= 2 // number is now 10
For a full list of operators, go to 2.2 Operators.
You can also set and make multiple variables at once.
make int x, y = 1, 2
set x, y = y, x // x is now 2, y is now 1
This swaps the values of x and y.
You can also use this to set multiple variables to the same value.
make int x, y = 0, 1
set x, y += 5 // x is now 5, y is now 6
set x, y = 10 // x is now 10, y is now 10
set x, y = 12, 14 // x is now 12, y is now 14
const is used to create a constant variable.
const is followed by the type of the variable, the name of the variable and the value of the variable.
The value of a constant variable cannot be changed.
Here's an example:
const int number = 5
This creates a new constant variable called number
with the value 5
.
The type of the variable is int
.
The value of the variable cannot be changed.
Here are a few examples of valid constant variable declarations:
const int number = 5
const float floatNum = 5.5F
const string name = "Robotnik"
const bool valid = true
If you want to use the var type explicitly (a generic type that can store any type of data), you can also not specify a type.
const value = 10 // 10