41 lines
866 B
Markdown
Raw Normal View History

2016-03-25 16:47:20 -07:00
# Assignment Operator
2016-04-01 16:22:47 -07:00
Set the value for local and global variables.
2016-03-25 16:47:20 -07:00
### @parent blocks/operators
Set or change the value of a variable
````blocks
let item = 0
````
2016-04-13 08:27:45 -07:00
Use the assignment operator to set or change the value of a [variable](/reference/variables/var).
2016-03-25 16:47:20 -07:00
### Declare a variable
2016-04-13 08:27:45 -07:00
Declare a new *local* variable using the [variable](/reference/variables/var) statement and the assignment operator. Like this:
2016-03-25 16:47:20 -07:00
````blocks
let num1 = 42;
let name = "Joe";
````
The variable's name is on the left of the assignment operator and the variable's value is on the right:
````blocks
let num1 = 42
````
### Notes
2016-04-18 08:33:09 -07:00
* You can use the assignment operator with variables of each of the supported [types](/reference/types).
2016-03-25 16:47:20 -07:00
### Lessons
2016-04-13 08:27:45 -07:00
[rotation animation](/lessons/rotation-animation)
2016-03-25 16:47:20 -07:00
### See also
2016-04-18 08:33:09 -07:00
[variable](/reference/variables/var), [types](/reference/types)
2016-03-25 16:47:20 -07:00