Branches, Loops, Arrays (3-5) Flashcards
A loop variable update that typically iterates a specific number of times.
for loop
This kind of loop repeatedly executes the loop body if the loop’s expression evaluates to true.
while loop
A ___ is a loop that first executes the loop body’s statements, then checks the loop condition. Used when the loop should iterate at least once.
do-while loop
A decision and its two branches; the decision’s expression is true then the first branch executes, if it is false the second branch executes.
if-else statement
A ____ is a sequence of statements only executed under a certain condition.
branch
A decision whose false branch has no statements is often just called an
if statement
A ___ is a loop that appears in the body of another loop. Can be made up of any loop type such as for, while, do-while.
nested loop
The two portions of a nested loop are commonly referred to as the…
inner loop and outer loop
A special variable having one name, but storing a list of data items, with each item being directly accessible.
array
Each item in an array is known as a(n) ____.
Element
In an array, each element’s location number is called the ___. Often enclosed in square brackets [ ] and must be an integer.
Index
What is the index of apple in the follow array?
Apple[?]
Orange[?]
Banana[?]
[0]
index starts at 0
What is the index of Orange in the follow array?
Apple[?]
Orange[?]
Banana[?]
[1]
index starts at 0
What is the index of Banana in the follow array?
Apple[?]
Orange[?]
Banana[?]
[3]
index starts at 0
Each time through a loops statements is called a(n)
iteration