You can change the value stored in a variable with the assignment operator =.
myVar := 5
myVar = 10
fmt.Println(myVar) // Output: 10
The first line creates myVar. The second line reassigns it to a new value.
Assigning the value of one variable to another:
myVar := 5
myNum := 10
myVar = myNum
fmt.Println(myVar) // Output: 10
After the assignment, myVar has the same value as myNum.
Assignment
Follow the Coding Tutorial and reassign the variables in the marked area.
Hint
Use =, not :=, because the variables already exist.
Free plan: 30 tutor messages. Premium is unlimited.
Saved
Ctrl + Enter to check
