What is a loop?
A program that continues to repeat as long as the expression is true.
What is another name for a loops statement?
Loop body
Each time through a loop is known as a?
iteration
How does a loop start?
With a decision statement
Does a loop cancel midway if the expression becomes false during the loop?
No, the loop finishes
When writing loops in a word expression what single operator is used to express “until”
!=
What is a sentinel value?
a special value signaling the end of a list of values.
Example: 13 8 5 0 (0 is the sentinel value)
How many parts does an iterating loop have?
3
What are the 3 parts of an iterating loop in order?
1) loop variable initialization
2) loop expression
3) loop variable update
explain loop expressions and how many times it will iterate.
i < 3 is the loop expressions. The loop will continue until the the expression is 3 which it will then exit the loop.
What is a “while loop”?
A loop that continues to execute long as it is true.
What is a “for loop”?
Is similar to a N loop.
If the iteration is known before the loop is it best to use a while or for loop?
For
What is a nested loop?
A loop that appears in the body of another loop.
How to know how many times an inner (nested) loop will execute?
outer loop * inner loop
When writing a while loop does the statements following need to be indented or not?
They need to be indented because they correlate to the “while loop”
When starting/writing a loop statement what “word” signifies/identifies that the loop will continue until the condition is met?
“While”
what does a do-while loop do?
executes the loop body’s statement first, then checks the loops conditions. (this ensures it executes atleast once.)
What is a “for loop”?
A loop with three parts at the top.
For example: for i = 0; i < 3; i = i + 1
In a “for loop” how do you seperate the three parts?
With a semi-colon, a semi-colon is not needed at the end.
If a iteration is omputable before the loop which type of loop statement should you use if or while?
For