1/44
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Iterative Structures
Structures that cover While Loop, Do-while Loop, For Loop, Nested Loop, Break, and Continue.
While Loop
Repeats a block of statements while a given condition evaluates to true.
While Loop
Evaluates the condition before executing the loop body.
While Loop Syntax
while (expression) {
// statements
}Expression in While Loop
A loop condition enclosed in parentheses in the While Loop
Expression in While Loop
Can be a relational or a logical expression that returns either a true or false value.
Loop Body
The statements enclosed in curly braces in the While Loop.
Loop Body
Can be either a simple statement or a compound statement.
Do–While Loop
Similar to a while loop but executes the loop body first before evaluating the expression.
Do–While Loop
The body is executed at least one before the expression is even evaluated.
Do–While Loop Syntax
do {
// statements
}
while (expression);Do–While Loop
The expression appears at the end of the loop.
Do–While Loop
The statements in the loop are executed once before the expression is evaluated.
Do–While Loop
If the expression evaluates to true, control jumps back to the do statement.
Do–While Loop
The loop body executes repeatedly until the expression evaluates to false.
For Loop
Executes a sequence of statements multiple times.
For Loop
Abbreviates the code that manages the loop variable.
For Loop
Used when a definite number of loop iterations is required.
For Loop Syntax
for (initialization; condition; update) {
// statements
}Initialization in For Loop
Indicates the starting value for the loop control variable.
Condition in For Loop
The loop condition that controls loop entry.
Update in For Loop
The expression that alters the loop control variable.
For Loop Parameters
Enclosed within parentheses in the For Loop.
For Loop Parameters
Separated by two (2) semicolons (;) in the For Loop
For Loop Parameters
What do you call the statements within the parentheses of the For Loop?for(initialization; condition; update) {
Initialization
This executes first and only once in the first step of the For Loop
Condition
This is evaluated in the second step of the For Loop
Terminates
In the Step 2 of the For loop: If the loop condition evaluates to false, the loop _______.
Executes
In the Step 2 of the For loop: If the loop condition evaluates to true, the loop _______.
Nested Control Structures
Control statements that are placed within another control statement.
Nested Control Structures
Control structures in Java can be nested in many levels.
Nested Control Structures
Start and end braces must be placed correctly within the control structure.
Nested Loop
A loop placed inside another loop.
Nested Loop
It is used to print patterns or multiplication tables.
Outer Loop
It runs once and only iterates once the inner loop has broke or gotten past its condition.
Inner Loop
It runs all over again until a false value then breaks out of the loop, then goes out to the outer loop again and reiterates the outer loop.
Break
A control statement discussed under iterative structures.
Break
It is always used together with an If conditional statement
Break
It immediately terminates the innermost loop.
Break
It transfers execution to the next statement outside that block.
Break
It is commonly used in if statements within loops to exit prematurely based on a condition.
break;
It is the syntax of the break control statement.
Continue
It immediately ends the current iteration of a for, while, or do-while loop, skipping any remaining code, and jumps to the next iteration (or re-evaluates the loop condition)
Continue
It is commonly used within if statements to bypass specific, unwanted iterations without terminating the entire loop.
continue;
It is the syntax for the continue statement.