Intro To Local Variables Flashcards
1
Q
Local variables
A
Function parameters defined inside functions body, destroyed opposite of order of creation in running time and must be defined as close to their first use.
2
Q
Identifier’s scope
A
Determines where the identifier can be accessed in the source code
3
Q
Scope
A
Compile time property
4
Q
Local variable’s scope
A
Begins at the point of variable definition, ends at the end of the curly braces
5
Q
Uses of functions
A
- statements that appear more than once in a program
- code thet has well defined inputs and outputs (ex. Input-unsorted list output-sorted)
- when a function becomes too long, complicated, hard to understand
6
Q
W hitespace
A
Characters that are used for formatting, space, tab and newline
7
Q
Basic formatting
A
- not enforced
- function braces either on the same line as a statement or on its own line
- each statement should start 1 tab in from the opening line
- maximum 80 characters in a line
- operators on the biggining of the next line
- use whitespace to allign values or comments