Page 60 - CG_v2.1_flipBooks_class_3
P. 60

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





                       58    Computer Genius (V2.1)-III
   55   56   57   58   59   60   61   62   63   64   65