Page 81 - Touchcode_C6_Flipbook
P. 81
At a Glance
In programming, repetition of a line of code or a block of code which is repeating again and
again is known as iteration.
A loop is an algorithm which executes a block of code multiple times until a specific condition
is met.
Moving to the next iteration, you need to increase the count of iteration to one is incrementing
a loop.
Loops make the code more manageable and organised.
A loop allows you to execute a statement or group of statements multiple times.
'For' loop is used for iterating over sequence a specific number of times.
When there is a loop inside another loop, it is called a nested loop.
Entry criteria is a condition which must be met or must exist before starting a specific task.
An exit criteria is a set of conditions that must exist before when you can declare a program
to be complete.
The break statement alters or changes the normal flow of execution of the statement by
terminating the existing loop and continues the execution of the statement following that
loop.
The continue statement forces the next iteration of the loop to take place, and skips the
code within the loop.
Exercise
A. Tick ( ) the correct option.
1. Which of the following executes a block of code multiple times until a specific condition is
met?
a. Iteration b. Loop
c. Continue statement d. Break statement
2. Which of the following track indicates how many times the loop is executed?
a. Counter variable b. Incrementing loop
c. While loop d. For loop
3. Which of the following loop executes a statement or group of statements till a given condition
is true?
a. While loop b. For loop
c. Nested loop d. Incrementing loop
Loops Using Block Coding 79

