Page 113 - Touchpad_Plus_V3.2_Class 5
P. 113

We can also make the sprite speak the answer by joining text and string.

                 For this, we need to use this code for the sprite Abby. The output of the code will
                 be similar to this depending upon the input of the user.


























                                                                Output


                                   Suppose, you have to code a dance party in Scratch where characters
                                   keep dancing in a loop until stopped? Which block will you use for

                                   this and which songs would you play in the program?


                     LOOPS

                 All the programs or projects developed till now ran only once. If you want to run a

                 set of statements more than once, you will either run the code again or write the
                 script again. In Scratch, we can save our time and effort by repeating the code
                 without  writing  the  program  again  or  writing  the  script again.  The  automatic

                 running of a set of instructions more than once is called looping. The blocks for
                 looping are given in Control category.
                 The Repeat block is used to run a set of instructions for a specified

                 number of times.


                                   The Repeat Until block is used to run a set of instructions till a

                                   condition is satisfied.


                 The Forever block is used to run a set of instructions continuously

                 until stopped. The instructions inside this block will be executed in
                 a loop until the Stop button            is clicked by the user.




                                                                                               More on Scratch       111
   108   109   110   111   112   113   114   115   116   117   118