Page 177 - Learn To Program With Scratch
P. 177

7


















                                    r e Pe t i t ion:   a De e Pe r
                                   e x PL or at ion of L oo P S













                          You’ve seen some of Scratch’s repetition structures
                          before, but this chapter covers them in greater detail.
                          It’s time to discuss new blocks that create loops, nested
                          loops, and recursion. By the end of this chapter, we’ll

                          have explored the following programming concepts:

                          •   Repetition structures to execute statements repeatedly
                          •   How to validate user input
                          •   Counter-controlled and event-controlled loops
                          •   Procedures that can call themselves with recursion
                             Although most people find repetitive tasks boring, computers seem to
                          like nothing more. Repetition structures, better known as loops, are program-
                          ming commands that tell a computer to repeatedly execute a statement or
                          a sequence of statements. The simplest kind of loop is a definite loop, which
                          repeats a sequence of statements a specific number of times. These loops





                                           www.it-ebooks.info
   172   173   174   175   176   177   178   179   180   181   182