Test yourself on Variable Scope with exam style questions, marked instantly.
Flashcards that come back just before you would forget them.
A revision plan that remembers what you know and shows what to do next.
See which topics you have nailed and which need another look.
Quiz yourself on Variable ScopeGet your flashcardsBuild my revision planTrack my progressWhere 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!
Each function box is its own local scope, inside the global scope. Global variables are named by OCR and Edexcel. In OCR pseudocode a global variable is declared with the word global, for example global userID = "Cust001". AQA names local variables and why they are good practice.
Make this stick
Signing in gives access to all PrepWise features.