Want to create interactive content? It’s easy in Genially!
Loops Content
Tomas
Created on February 27, 2025
Start designing with a free template
Discover more than 1500 professional designs like these:
Transcript
Example: for(condition) {code to execute}
DO-WHILE lOOP
Example:do {code to execute} while (condition)
WHILE LOOP
Example:while(condition) { code to execute}
fOReACH LOOP
Example:foreach(condition) {code to execute}
fOR lOOP
Loops
Tech School
Let's go through possible loops also called control flow statements:
While loop continually executes a block of code as long as a specified condition remains true. The difference between while and for loop is that for loop iterates known length sequences, where the while loop is ideal when the number of iterations is not predetermined, but the condition we want is.
While Loop
Foreach loop is used when we are trying to iterate through each element in a list.
Foreach Loop
Do-while loop is basically a while loop, with the difference being that we run the code at least once first before iterating through conditional loop.
Do-While Loop
A For Loop is an iteration that allows a code to be executed repeatedly as long as a Boolean condition is true. It is used to iterate over a sequence of elements or perform a set of tasks a fixed number of times.