#
Variables
A variable
is kind of like a named box that holds something.
Here is a quick example in Java:
boolean isRobotOn = false;
To create a variable, you need 4 things:
- You need a
type
, atype
tells us what that "something" is. In this case ourtype
is aboolean
which stores either a true or false. - You need a name, which in this case is
isRobotOn
, you will use this name to refrence the variable later. - You need an equals sign, this is how we tell Java that we want to assign a variable to a value.
- And lastly, you need a value, which in this case is
false
.
#
Common Types in Robot Programming and Their Values
More information on booleans is available at Control Flow.
More information on types is available at Types.
For more information of variables, consider checking out the W3 Schools Java Tutorial.