41 lines
860 B
Markdown
41 lines
860 B
Markdown
# Assignment Operator
|
|
|
|
Set the value for local and global variables.
|
|
|
|
### @parent blocks/operators
|
|
|
|
Set or change the value of a variable
|
|
|
|
````blocks
|
|
let item = 0
|
|
````
|
|
|
|
Use the assignment operator to set or change the value of a [variable](/reference/variables/var).
|
|
|
|
### Declare a variable
|
|
|
|
Declare a new *local* variable using the [variable](/reference/variables/var) statement and the assignment operator. Like this:
|
|
|
|
````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
|
|
|
|
* You can use the assignment operator with variables of each of the supported [types](/blocks/types).
|
|
|
|
### Lessons
|
|
|
|
[rotation animation](/lessons/rotation-animation)
|
|
|
|
### See also
|
|
|
|
[variable](/reference/variables/var), [types](/blocks/types)
|
|
|