Reference.Scope History

Hide minor edits - Show changes to output

July 22, 2013, at 11:22 AM by Roberto Guido - minor historical correction. Thanks Roger Linhart for feedback
Changed lines 3-4 from:
Variables in the C programming language, which Arduino uses, have a property called ''scope''. This is in contrast to languages such as BASIC where every variable is a ''global'' variable.
to:
Variables in the C programming language, which Arduino uses, have a property called ''scope''. This is in contrast to early versions of languages such as BASIC where every variable is a ''global'' variable.
January 06, 2009, at 10:32 PM by Paul Badger -
Changed lines 7-8 from:
When programs start to get larger and more complex, local variables are a useful way to insure that only one function has access to its variables. This prevents programming errors when one function inadvertently modifies variables used by another function.
to:
When programs start to get larger and more complex, local variables are a useful way to insure that only one function has access to its own variables. This prevents programming errors when one function inadvertently modifies variables used by another function.
December 29, 2008, at 12:35 AM by Paul Badger -
Changed lines 9-10 from:
It is also sometimes handy to declare and initialize variables inside ''for'' loops. This creates variables that can only be accessed from inside the for-loop brackets.
to:
It is also sometimes handy to declare and initialize a variable inside a ''for'' loop. This creates a variable that can only be accessed from inside the for-loop brackets.
December 29, 2008, at 12:34 AM by Paul Badger -
Changed lines 9-10 from:
It is also sometimes handy to declare and initialize variables inside ''for'' loops. This creates variables that can only be accessed from inside the ''for'' loop brackets.
to:
It is also sometimes handy to declare and initialize variables inside ''for'' loops. This creates variables that can only be accessed from inside the for-loop brackets.
Changed line 26 from:
// variable j can only be accessed inside the for loop brackets
to:
// variable j can only be accessed inside the for-loop brackets
December 29, 2008, at 12:33 AM by Paul Badger -
Changed lines 25-30 from:
for (int j = 0; j <100; j++){
// variable j can only be accessed inside the for loop brackets
}


to:
for (int j = 0; j <100; j++){
// variable j can only be accessed inside the for loop brackets
}
December 29, 2008, at 12:32 AM by Paul Badger -
Changed lines 5-6 from:
A global variable is one that can be ''seen'' by every function in a program. Local variables are only visible to the function in which they are declared. In the Arduino environment, any variable declared outside of a function (e.g. setup(), loop() ), is a global variable.
to:
A global variable is one that can be ''seen'' by every function in a program. Local variables are only visible to the function in which they are declared. In the Arduino environment, any variable declared outside of a function (e.g. setup(), loop(), etc. ), is a global variable.
Added lines 9-10:
It is also sometimes handy to declare and initialize variables inside ''for'' loops. This creates variables that can only be accessed from inside the ''for'' loop brackets.
Added lines 24-30:

for (int j = 0; j <100; j++){
// variable j can only be accessed inside the for loop brackets
}


September 06, 2008, at 09:06 PM by Paul Badger -
September 06, 2008, at 09:04 PM by Paul Badger -
Changed lines 3-4 from:
Variables in the C programming language, which Arduino uses, have a property called "scope". This is in contrast to languages such as BASIC where every variable is a ''global'' variable.
to:
Variables in the C programming language, which Arduino uses, have a property called ''scope''. This is in contrast to languages such as BASIC where every variable is a ''global'' variable.
September 06, 2008, at 08:54 PM by Paul Badger -
September 06, 2008, at 08:53 PM by Paul Badger -
Changed lines 5-6 from:
A global variable is one that can be seen by every function in a program. Local variables are only visible to the function in which they are declared. In the Arduino environment, any variable declared outside of a function (e.g. setup(), loop() ), is a global variable.
to:
A global variable is one that can be ''seen'' by every function in a program. Local variables are only visible to the function in which they are declared. In the Arduino environment, any variable declared outside of a function (e.g. setup(), loop() ), is a global variable.
July 17, 2007, at 08:10 PM by David A. Mellis - formatting example code
Changed lines 12-13 from:
void setup(){
// ...
to:
void setup()
{
// ...
Changed lines 17-20 from:
void loop(){
int i; // "i" is only "visible" inside of "loop"
float f; // "f" is only "visible" inside of "loop"
// ...
to:
void loop()
{
int i; // "i" is only "visible" inside of "loop"
float f; // "f" is only "visible" inside of "loop"
// ...
July 17, 2007, at 08:10 PM by David A. Mellis - IDE -> environment
Changed lines 5-6 from:
A global variable is one that can be seen by every function in a program. Local variables are only visible to the function in which they are declared. In the Arduino IDE, any variable declared outside of a function (e.g. setup(), loop() ), is a global variable.
to:
A global variable is one that can be seen by every function in a program. Local variables are only visible to the function in which they are declared. In the Arduino environment, any variable declared outside of a function (e.g. setup(), loop() ), is a global variable.
July 17, 2007, at 06:51 AM by Paul Badger -
Changed lines 5-6 from:
A global variable is one that can be seen by every function in a program. Local variables are only visible to the function in which they are declared.
to:
A global variable is one that can be seen by every function in a program. Local variables are only visible to the function in which they are declared. In the Arduino IDE, any variable declared outside of a function (e.g. setup(), loop() ), is a global variable.
May 15, 2007, at 05:07 AM by Paul Badger -
Changed lines 7-8 from:
When programs start to get larger and more complex, local variables are a useful way to insure that only one function has access to its variables. This prevents inadvertent programming bugs when one function modifies variables used by another function.
to:
When programs start to get larger and more complex, local variables are a useful way to insure that only one function has access to its variables. This prevents programming errors when one function inadvertently modifies variables used by another function.
May 15, 2007, at 05:05 AM by Paul Badger -
Added lines 7-8:
When programs start to get larger and more complex, local variables are a useful way to insure that only one function has access to its variables. This prevents inadvertent programming bugs when one function modifies variables used by another function.
May 04, 2007, at 01:15 PM by Paul Badger -
Changed lines 15-16 from:
int i; // only "visible" inside of "loop"
float f;
to:
int i; // "i" is only "visible" inside of "loop"
float f; // "f" is only "visible" inside of "loop"
May 04, 2007, at 01:14 PM by Paul Badger -
Changed lines 8-10 from:

int gPWMval; // any function will see this variable
to:
[@int gPWMval; // any function will see this variable
Changed line 18 from:
}
to:
}@]
May 04, 2007, at 01:13 PM by Paul Badger -
Changed lines 3-19 from:
Variables in the C programming languange, which Arduino uses, have a property called "scope". This is in contrast to languages such as BASIC where every variable is a ''gloabal'' variable.
to:
Variables in the C programming language, which Arduino uses, have a property called "scope". This is in contrast to languages such as BASIC where every variable is a ''global'' variable.

A global variable is one that can be seen by every function in a program. Local variables are only visible to the function in which they are declared.

!!!! Example:

int gPWMval; // any function will see this variable

void setup(){
// ...
}

void loop(){
int i; // only "visible" inside of "loop"
float f;
// ...
}
May 04, 2007, at 01:07 PM by Paul Badger -
Changed line 3 from:
Variables in the C programming languange, which Arduino uses, have a property called "scope". This is in contrast to languages such as BASIC where every variable is a //gloabal// variable.
to:
Variables in the C programming languange, which Arduino uses, have a property called "scope". This is in contrast to languages such as BASIC where every variable is a ''gloabal'' variable.
May 04, 2007, at 01:05 PM by Paul Badger -
Changed line 3 from:
Variables in the C programming languange, which Arduino uses, have a property called "scope". This is in contrast to languages such as BASIC where every variable is a !!!gloabal!!! variable.
to:
Variables in the C programming languange, which Arduino uses, have a property called "scope". This is in contrast to languages such as BASIC where every variable is a //gloabal// variable.
May 04, 2007, at 01:04 PM by Paul Badger -
May 04, 2007, at 01:04 PM by Paul Badger -
Changed line 3 from:
Variables in the C programming languange, which Arduino uses, have a property called "scope". This is in contrast to languages such as BASIC where every variable is a !!gloabal!! variable.
to:
Variables in the C programming languange, which Arduino uses, have a property called "scope". This is in contrast to languages such as BASIC where every variable is a !!!gloabal!!! variable.
May 04, 2007, at 01:04 PM by Paul Badger -
Added lines 1-3:
!! Variable Scope

Variables in the C programming languange, which Arduino uses, have a property called "scope". This is in contrast to languages such as BASIC where every variable is a !!gloabal!! variable.

Share