2.3.5: understand the need for, and how to use, global and local variables when implementing subprograms
Keyword | Definition |
---|---|
Global variable | a variable that can be accessed from any part of the code because it was declared outside any sub program |
Local variable | a variable that can only be accessed inside the sub program where it was declared. |
Scope | the part of a program where you can access a variable or constant |
Sub program | a part of a program (procedure or function) that has its own scope |