Page 63 - ModularV1.1 _c5_flipbook
P. 63

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

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























                     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.
                                                                                                          repeat  10
                 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                      repeat  until
                 condition is satisfied.

                 The Forever block is used to run a set of instructions continuously                      forever
                 until stopped. The instructions inside this block will be executed in

                 a loop until the Stop button            is clicked by the user.

                 The Repeat and Repeat Until blocks can be used to display the table of a number

                 input by the user. The script for the sprite can be like this (using Repeat Until block).


















                                                                                       Advanced Blocks in Scratch  61
   58   59   60   61   62   63   64   65   66   67   68