Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
Global variables are variables that are declared outside of any function and can be accessed from anywhere within the program. They have a global scope, meaning they can be used by any part of the code.
Local variables are declared inside a specific function and can only be accessed within that function. They have a local scope, meaning they are limited to their own little "bubble".
A parameter is a special type of variable used in functions to receive values when the function is called. It acts as a placeholder for the actual values that will be passed into the function.
Scope refers to the visibility or accessibility of variables within different parts of a program. The scope determines where and for how long a variable exists and can be referenced.