7. Programming Constructs Flashcards
What is Sequence?
Sequence is when the lines of code are run one line at a time and the lines are run in the order they were written in.
What is Branching (Selection)?
Branching is when the flow of the program is interrupted and a condition is tested.
The outcome of the condition will determine which lines or block of code is to run next
Tow ways to write Selection statements?
If, elseif and else statements: this is when you test conditions sequentially.
switch & case statements: this is when you test an expression against multiple possible constant values known as cases.
What is iteration?
Iteration is repeating a line or a block of code using a loop
What are the two types of iteration?
Count controlled: this is when the code is repeated a fixed number of times (using for loop)
Condition controlled: this is when the code is repeated and until a condition is met ( using a while loop or a do wire loop)