This was precisely the solution previously proposed here:
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Another possible solution to the global scope debacle | 229 | 20801 | November 6, 2018 | |
| Global scope confusion again | 52 | 7287 | May 17, 2025 | |
| Local vs global scope again | 30 | 2601 | August 9, 2020 | |
| Explain scoping confusion to a programming beginner | 26 | 3451 | August 11, 2020 | |
| REPL and for loops (scope behavior change) | 42 | 15503 | September 16, 2020 |