used to execute a block of code repeatedly based on a specific condition.
2
New cards
iteration statements
they allow the same code to be executed multiple times in a loop until the condition is satisfied.
3
New cards
Loops
an essential part of programming as they help in reducing code redundancy and automate repetitive tasks.
4
New cards
break and continue
statements that modify the flow of a loop or exit a loop prematurely.
5
New cards
While loop
loops through a block of code as long as a specified condition is true
6
New cards
Do-while loop
a variant of the while loop. This loop will execute the code block once, before checking if the condition is true, then it will repeat the loop as long as the condition is true
7
New cards
For loop
When you know exactly how many times you want to loop through a block of code, use this instead of a while loop
8
New cards
Statement 1
is executed (one time) before the execution of the code block. (FOR LOOP)
9
New cards
Statement 2
defines the condition for executing the code block. (FOR LOOP)
10
New cards
Statement 3
is executed (every time) after the code block has been executed. (FOR LOOP)