- All variables either have a global or local "scope".
- A variable inside a method can be used only inside that method. Its local scope.
- Variables may be localized within classes, methods, and loop statements.
- A variable declared outside the setup() or draw(), in the global section has global scope.
- A local variable will override the Global variable with the same name.
int a = 20; // global variable "a"
void setup()
{
size(200, 200);
background(51);
stroke(255);
}
void draw()
{
int b = 20; // local variable "b"
}