Lesson 10: Programming (loops)

 April 28th, 2021

Guest Post] 11 Programming Languages To Learn For New Opportunities - GQR

Welcome back everyone!! Today we are going to talk about loops. A loop is nothing more than a repetition of something as many times as we want, as long as we want or as long as a condition is fulfilled. For example, if we are in a class with 20 people and I want to share my 20 candies, I will have to give each person a candy, and repeat this action 20 times. In other words, I have made a loop in which I have repeated the action of giving a caramel to a person 20 times. We can also talk about taking steps on tiles. We imagine that we are just taking steps from a tile and want to reach the end of the corridor. There are 15 tiles in between, so I'll have to take 15 steps to get it. If we put the 15 shares together in one order, it would be a loop. An example of how we would show the students loops can be seen in Primary Code down below:


















Also, in this class, we talked about loops through using Scratch. It is the orange cat icon you have on the desktop. (The first topic is about how to use Scratch, but the best thing is once it is opened after this theoretical explanation, go explain everything at once). We will try to put into practice the examples we have seen before. But first let's see where everything is. If we go to the "Control" tab, we can find three blocks of loops, one that says "repeat ___", another that says "forever" and another that says "repeat until ___". The first we will use when we want that what is inside be executed n times, the second when we want it to be executed again and again; and the third one we want to be executed while the condition is fulfilled. An example of some loops that we could create are down below:


Comments

Popular Posts