Page 86 - Trackpad_V2.1_class8
P. 86

For example:
                  Robby has to paint these blank boxes to make a letter ‘U’
                   Start                         Start

                                                                               Just as plants need sunlight to produce
                                                                               Just as plants need sunlight to produce
                                                                                glucose, algorithms need right data to
                                                                                glucose, algorithms need right data to
                                                                                     generate optimum results.generate optimum results.




                  The program will be



                                                                            Repeat 4 times
                         Move 1 down and Fill Colour
                         Move 1 down and Fill Colour                        (Move 1 down and Fill Colour)
                         Move 1 down and Fill Colour
                         Move 1 down and Fill Colour                        Repeat 2 times
                         Move 1 right and Fill Colour                       (Move 1 right and Fill Colour)
                         Move 1 right and Fill Colour
                                                                            Repeat 3 times
                         Move 1 up and Fill Colour
                         Move 1 up and Fill Colour                          (Move 1 up and Fill Colour)
                         Move 1 up and Fill Colour


                               Program without a loop                              Program with a loop



                  Look at another examples:

                  1.   Move 1 step down                                       St


                       Repeat 6 times
                       (

                       Fill color

                       Move 1 right
                       )



                  2.   Repeat  until  reached  last                           St

                       column
                       (

                       Fill color

                       Move 1 right
                       )






                   84   Trackpad (V2.1)-VIII
   81   82   83   84   85   86   87   88   89   90   91