Page 114 - KEC Khaitan C3 Flipbook
P. 114
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, you can save your 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.
Let us create a small script to see the looping blocks use.
Create the following script and click on the Green Flag:
CREATING A SCRATCH PROJECT
Scratch allows you to animate sprites and add sounds using different block
categories. Let's create an exciting project that combines movement and sound
using Scratch blocks!
112 Premium Edition-III

