Page 24 - Touchcode_C7_Flipbook
P. 24
Explanation: To print all the natural numbers from 1 to 100, the program will repeat
or iterate for each number from 1 to 100. For every single iteration, it will check for the
condition and take the appropriate path. This is how iteration works in programming.
WHAT IS A BUG?
A bug is an unexpected problem in your program. You follow a defined sequence to write
a program, from which you expect to return a specific output. Any change in the expected
and actual output of the program is said to be the result of a bug.
So, we can say that bug is a general term which is used to describe any unexpected problem
with hardware or software.
Life Skill and Values
Example: Suppose you are going out for a family picnic. You are ready to go, but you
notice that the tyre of the car is puncture, due to which your picnic will get delayed
for few hours or you need to postpone it for some other day. As first you need to
repair the tyre. So, this puncture in the tyre of the car can be termed as a ‘bug’ in
programming.
Experiential Learning
Coding Task 01
To create a rectangle
In this task, you will learn to create a rectangle 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 rectangle’,
and click on ‘Create’.
Step 2: Create two variables ‘blueRect’ and ‘showBlue’.
Step 3: Select the block ‘set blueRect’ from ‘Variable’, and from
image select the block ‘create image width 0 height 0’. Drag
the ‘create image width 0 height 0’ block to ‘set blueRect’ block. Drag and drop
the block to ‘on start’ block. (Change the value of width and height to 32 and 50)
Step 4: From ‘Image’ select ‘fill picture with’ block. Click on the drop-down arrow and
select ‘blueRect’, and change the color to ‘pink’. Drag the block to ‘on start’ block
and drop it to below the ‘set blueRect’ block.
22 Touchcode-VII

