Control Structures Flashcards
Branch
Sequence of statements only executed under certain condition(s)
If-Else Branch
If decision’s expression is true then the first branch executes, else the second branch executes
IfElseIf Branch
A branch may contain a decision and branches.
Nested If-Else Branch
An if-else branch in another if-else branch
Multiple If Branches
Each decision is independent, more than one branch can execute
If Statement
If expression by sub-statements, with no else part
Loop
Repeatedly executes loop’s statements (loop body) while the loop’s expression is true
Iteration
Each time through a loop’s statements
Infinite Loop
Never stops iterating
Sentinel Value
Special value indicating the end of a list
For Loop
Iterating N times
While Loop
Execute while the loop expression evaluates to true
Nested Loop
Loop (inner loop) that appears in the body of another loop (outer loop)
Do-While Loop
First executes loop body’s statement then checks loop condition