Page 63 - Digicode_AI_class_3
P. 63

Loops

            The act of repeating an action again and again is called looping.
            Let us understand loops with the help of an example.
            You can observe that first Harry goes up towards the sky.







                                         In the second round, Harry and Jerry are both at the same level.








            In the third round, Jerry is at a higher level. Thus, the cycle
            goes on.

            Repeating a set of steps is a loop.


            Understanding Programs

            A computer understands step-by-step instructions written only in a unique language, known

            as program. The computer reads the program we write and follows as per our instructions.
            Let us write a program to make a square.






                Move 2 steps right.
                Move 2 steps up.

                Move 2 steps left.
                Move 2 steps down.




                                                                                  Start
            Similarly, we can write a program to make a rectangle.




                Move 2 steps right.
                Move 1 step up.

                Move 2 steps left.
                Move 1 step down.
                                                                                  Start




                                                                                      Stepwise Thinking   61
   58   59   60   61   62   63   64   65   66   67   68