11. Variables

A variable has the ability to remember a value that was set into it. To create a new variable we will use the following command:make "VAR_NAME VAR_VALUE. For example: the command make "x 3 will set the value 3 in the variable x.
Create a new variable called y and set its value to 5
To access the variable value we should put the colon (:) sign before the variables name. To access the content of the variable y will will use - :y
Print the value of variable y
We can sum 2 values together using the sum command The command structure is -sum FIRST_VALUE SECOND_VALUE. For example: sum 2 4 will show us 6
Print the sum of 2 and 4
Using the sum command we learned before, let's create a new variable named x
Set a variable x with the value of the sum of 3 + 6
Now we have 2 variables with set values - x and y. We can view their values using the print command this way - print :x , print :y
Print the sum of x and y ( x + y )
A Difference command looks like the same as the sum command, only instead of adding up - it subtracts. It looks like this: difference VAR_A VAR_B
Set var z to contain the value of x-y
TurtleAcademy learn programming for freeYour browser is not supporting canvasWe recomand you to use Chrome or Firefox browsers