AQA 7517 4.1.1.13: Local variables in subroutines
The free BugBot lessons that teach this point, a robot to try it on, and the past-paper questions that test it.
What it covers
At GCSE you met local and global variables (F4.3) and the tools of an IDE (F6.6). At A level you need two ideas for every variable, its scope and its lifetime, the reasons local variables are good practice, and how the debugging tools of an IDE find the errors that scope mistakes cause.
- Scope and lifetime
- Shadowing, and changing a global
- Why local variables are good practice
- Debugging tools
Or do it in the simulator, with tasks that mark themselves
Lessons that teach it
- A1.5 Scope, lifetime and debugging in an IDE Programming techniques and object-oriented programming
Local and global variables, why locals are good practice, and breakpoints, stepping, watches and tracebacks. - A1.10 Project: the behaviour controller Programming techniques and object-oriented programming
Get past a wall to the dock with prioritised behaviour classes, a controller that aggregates them, and an exception to finish.
Try it on a robot
The task from A1.5 Scope, lifetime and debugging in an IDE, running here. Change the program and press Run.
The specification is AQA's own document; this page says which of our lessons teach point 4.1.1.13 and is not endorsed by the board.