Year 10 - Computing
Global and local variables in programs
Programming: subroutines
Study Hub
This pupil-friendly study guide includes a unit summary, clear notes, common mistakes, and quick questions with answers.
Year 10 - Computing
Programming: subroutines
In this unit pupils will be introduced to structured programming. They will explore the differences between functions and procedures and use functions to return values in programs. They will be introduced to the concept of scope and how parameters can be used to reduce the need for global variables.
You will learn to explain the difference between a local and global variable.
The scope of a variable determines where it can be accessed. A local variable is a variable that is only accessible within a specific part of a program.
the section of the program where the variable can be accessed and modified. Add one real device or system example to prove understanding.
Mistake: Assigning a variable inside a function automatically makes it global. Correction: A variable is local, unless it is specifically set as a global variable.
Browse all guides in the Year 10 Computing guide library.