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