Private: Code with Blockly
About Lesson

It’s the Olympics, and the category is the 1600 m race. Runners take their stance. In the course of the race, they will be running 4 loops of a 400 m track, and as soon as the 4 rounds end, they stop running and break out of the track. But why loops? Why not a single 1600 m track?
Loops help not only organizers and referees to monitor the event but also make it easier for viewers to enjoy it. In many such instances, loops are preferred as they not only make it easier to perform a task but also weed out discrepancies if any at an earlier stage.
In mathematics, multiplication is repeated addition. Let’s take the following example
When we say 2 X 5, what it essentially means is to add the number 2, five times to its own sum.

In the above diagram, you can see that the loop is repeated five times. Now let’s practice this with a code.

It is important to note that while inside the loop, the print command comes before addition so that the results are 2-4-6-8-10. If it comes after the addition, the result will be 4-6-8-10-12.

The most common form of loop used in most programming languages is the do-while loop. Given below, you can see the basic flow of a code with a while loop. The code enters the loop as long as the condition for the loop is met.

Let us learn more about the while loop with the following example. Whenever you open blockly, the following code shows up on the screen.

Let us understand its mechanism.

That was all for reading. Now let us practice some more with the following activities.

error:
Fill in the form for S’O’A Fablab Orientation 2021.
Open chat
Hello! Welcome to Introduction » Karkhana!