-
Notifications
You must be signed in to change notification settings - Fork 38
Declarations
OutCraft edited this page Jun 22, 2023
·
2 revisions
To declare a variable, use the var keyword followed by a name.
var myVariable;RoboScript is a dynamically typed language, with all variables being able to be all types. All variables are null, meaning undefined, by default. To initialize the variable with a value other than null, you can follow the name of the variable with = and the value.
var myNumberVariable = 3;
var myTextVariable = "Hello World";
var myBoolVariable = true;To get a variable, simply write the name of the variable.
var myVariable = "Hello World";
print(myVariable) // Hello WorldTo edit an already existing variable write the name of the variable and set it with = and the new value.
var myVariable = "Hello World";
myVariable = "Another Hello World";
print(myVariable) // Another Hello World