Concept Flow - Adding and updating values
Start
Create variable
Add value
Update value
Use or print value
End
This flow shows how a variable is created, then a value is added or updated, and finally used or printed.
package main import "fmt" func main() { x := 10 x = x + 5 fmt.Println(x) }
| Step | Action | Variable x | Output |
|---|---|---|---|
| 1 | Declare x with 10 | 10 | |
| 2 | Add 5 to x and update | 15 | |
| 3 | Print x | 15 | 15 |
| Variable | Start | After Add | Final |
|---|---|---|---|
| x | 10 | 15 | 15 |
Adding and updating values in Go: - Declare variable: x := 10 - Update value: x = x + 5 - Variable holds new value after update - Use fmt.Println(x) to print - Variable changes immediately after update