pxt-calliope/docs/reference/variables/assign.md
2016-06-11 22:28:57 -04:00

37 lines
985 B
Markdown

# Assignment Operator
Use an equals sign to make a [variable](/reference/variables/var) store the [number](/reference/types/number)
or [string](/reference/types/string) you say.
When you use the equals sign to store something in a variable, the equals sign is called
an *assignment operator*, and what you store is called a *value*.
### Storing numbers in variables
This program makes the variable `item` equal `5` and then shows it on the [LED screen](/device/screen).
````blocks
let item = 5
basic.showNumber(item)
````
### Storing strings in variables
This program makes the variable `name` equal `Joe` and then shows it on the [LED screen](/device/screen).
````blocks
let name = "Joe"
basic.showString(name);
````
### Notes
You can use the assignment operator with variables of
every [type](/reference/types). A *type* is which kind of thing
a variable can store, like a number or string.
### See also
[variable](/reference/variables/var), [types](/reference/types)