Page 78 - CloudGPT_C8_Flipbook
P. 78
How Nested Loop Works
When the condition is true the outer While (Loop-Condition)
loop triggers the inner loop. This { While (Loop-Condition)
loop then executes normally until {
its condition becomes false. Once
the inner loop stops execution, Statement 1;
the outer loop starts again the Statement 2;
entire process is repeated until }
the condition in the outer loop is }
falsified. Inner Loop
Let’s take an example of the Outer Loop
analogue clock, it has three hands.
All the hands work in coordination with each other. The minute hand is the outer loop and
the second hand is the inner loop. When the second hand completes one revolution, the
minute hand moves by a minute. So, you can say that clock is another form of nested loop
and this is how nested loops work in real life.
Coding Task 01 Creativity
Building a music player
In this task, you will create a music player and learn to implement the concept of
increment loops with the help of the Arcade platform.
To perform the task, follow these steps:
Step 1: Open MakeCode, click on 'New Project'. Write the name of project 'building a
music player', and click on 'Create'.
Step 2: Click on 'Loops', and select 'repeat' block, drag it to the workspace and drop the
'repeat' block to 'on start' block.
76 Premium Edition-VIII

