Concept Flow - Why variables are needed
Start
Need to store data?
Yes
Create variable
Assign value
Use variable in code
Change value if needed
End
This flow shows how variables help us store and use data in a program step-by-step.
name = "Alice" age = 30 print(name) print(age)
| Step | Action | Variable | Value | Output |
|---|---|---|---|---|
| 1 | Assign 'Alice' to name | name | "Alice" | |
| 2 | Assign 30 to age | age | 30 | |
| 3 | Print name | name | "Alice" | Alice |
| 4 | Print age | age | 30 | 30 |
| 5 | End of program |
| Variable | Start | After Step 1 | After Step 2 | After Step 3 | After Step 4 | Final |
|---|---|---|---|---|---|---|
| name | undefined | "Alice" | "Alice" | "Alice" | "Alice" | "Alice" |
| age | undefined | undefined | 30 | 30 | 30 | 30 |
Variables store data with a name. Assign values using =. Use variables to print or calculate. Variables can change values anytime. They help reuse and update data easily.