Page 112 - TP_Plus_v4_Class4
P. 112
You can also use the forever and repeat blocks with these blocks.
Let us make a small script.
Change the sprite to butterfly and change the backdrop to
flowers.
The butterfly changes colour and size when it touches the colours
selected in the touch block.
Similarly, you can create scripts with two sprites, and they change
colour when they touch each other.
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 can 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 or
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.
repeat until
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. forever
The instructions inside this block will be executed in a loop until the Stop button
is clicked by the user.
110 PLUS (Ver. 4.0)-V

