Page 27 - Touchcode_C7_Flipbook
P. 27
Example: In a car race, a car must go around a track five times. The car will keep going
around the track repeatedly until it completes five laps. Once it is done, it will exit the track.
Now let’s combine all the three building blocks of an algorithm: sequencing, selection, and
iteration.
Let’s look at our cup of tea task with sequence, selection and iteration. We have the same
number of steps but our process has become more precise (how long to stir for), efficient
(we don’t fill the kettle if it has water in it already) and we have choice (milk or no milk).
Step 1: IF the kettle has no water THEN fill the kettle with water
Step 2: Turn the kettle on
Step 3: Put tea bag in the cup
Step 4: Pour hot water into the cup
Step 5: Remove tea bag
Step 6: IF you take milk THEN add milk
Step 7: If you take sugar THEN add sugar. Stir until the milk has been mixed into the tea.
In real life, complex algorithms can have hundreds of steps in a sequence and there are certain
activities in the sequence which are repeated. We can reduce the number of steps of the
sequence by using a loop along with certain conditions to check when the loop should stop.
IS THERE A BETTER WAY TO APPLY SEQUENCING?
Let us learn to apply sequencing through a coding task.
Experiential Learning
Coding Task 02
To create a square
In this task, you will learn to create a square in MakeCode Arcade.
To perform the task, follow these steps:
Step 1: Visit the link: https://arcade.makecode.com/. Click on ‘New
Project’, give a name to your project, ‘To create a square’,
and click on ‘Create’.
Step 2: Create two variables ‘blueSquare’ and ‘showBlue’.
Sequencing with Block Coding 25

