Keywords Flashcards
Local Variable
A variable that is created when the class is first called.
Static Variable
A variable that has had a memory location allocated for the entire lifetime of the run of the program.
Sequence
- The order in which software instructions are carried out.
* instructions are carried out in the order they appear.
Function/Method
- A common sequence of instructions.
- Can be declared as void where a return value is not required.
- If a return value is required, it’s type must be defined.
Loop
Allows a statement or group of statements to be executed more than once.
Repeats a set number of times or until a condition has been met.
Unconditional Repitition
The number of repititions is unknown.
Eg for loop
Conditional Repition
The number of repetitions is known.
Eg while loop
Selection
In a program it is possible to decide which statements to execute.
IE if or switch statement.
If Statements
Allows control to branch to the execution of a set of instructions only if the condition evaluates to be true.
If/Else Statements
Same as if statement but will include statements to be executed if the evaluation of the condition is FALSE.
For Loop
The counter is initialised.
The end value for the counter is declared and the increment for the counter set.
do While Loop
Same as while loop.
Executes at least one time.
Executes first then checks for specified loop condition.
Nested Loop
A loop within a loop.
Used for more complex problems.
Switch Statements
Allows multiple decisions to be affected. If relevant result in more efficient code than multiple IF statements.
Switch- case statement
Control is transferred to the case statement which matches the switch variable.
Switch-break
Execution proceeds until break statement transfers control out of switch structure.
A branch statement usually required after each case block unless case has no code.