Assignment operator (=)

Use an equals sign to make a variable store the number, string, or boolean you say.

let myNumber = 7
let myString = "Yellow Whirled"
let myLogic = true

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. A value can be a literal value, like 20 or "Dreaming". Or, a value can be another variable you want to copy, let newItem = oldItem.

Here is an example of variable assignment in code:

let perfect = 10;
let extra = 1;
let extraPerfect = perfect + extra;

You can use the assignment operator with variables of every type. A type is which kind of thing a variable can store, like a number or string.

See also

Variables, Change operator