This introduction covers Where Variables Live within Variable Scope for GCSE Computer Science. Revise Variable Scope in Programming for GCSE Computer Science with 15 exam-style questions and 10 flashcards. This topic appears less often, but it can still be a useful differentiator on mixed-topic papers. It is section 2 of 6 in this topic. Use this introduction to connect the idea to the wider topic before moving on to questions and flashcards.
Topic position
Section 2 of 6
Practice
15 questions
Recall
10 flashcards
Where Variables Live
Scope is where a variable can be seen and used. A local variable is like your bedroom - only you can access it, and when you leave, it's cleaned up. A global variable is like the living room - everyone in the house can use it, and it's always there. Local variables exist only inside their function. Global variables exist everywhere. Generally, prefer local - it's tidier and safer!