// Variable scope shown on the Serial Monitor output.
int a = 9600; // global "a"
void setup() {
Serial.begin(a); // using the global variable value of "a" = 9600
Serial.println(a); // global "a" = 9600
int a = 2; // this new "a = 2" is locally defined here, in "setup()" Global "a" is still 9600
for (int a = 7; a < 9; a++) { // this new "a" is local only inside "for"
Serial.println(a); // this "a" is local to this "for" loop
}
Serial.println(a); // this "a" is from the definition inside "setup" with a global "a" still 9600
}
void loop() {
Serial.println(a); // this is the global "a" without an over-riding, local variable "a"
while(1); //stay here
}