Page 88 - Computer Genius Class 05
P. 88
e can also rite this in t o ays
1. if 2. if
mango is available mango is available
then then
make the mango shake make the mango shake
else
ma e cold coffee
n such situations e use conditional loc s. cratch has t o conditional loc s. They are
1. If,then block: n this loc i the condition is true the loc s inside conditional loc
ill run. the condition is alse the loc s inside conditional loc ill not run. nly the
blocks outside the conditional block will run.
2. If,then,..else block: n this loc i the condition is true the loc s inside then condition
ill run. the condition is alse the loc s inside else condition will run.
You can also use the forever and repeat blocks with these blocks.
Let us make a small script.
Change the sprite to fish and change the backdrop to Underwater 2.
Drag the Event block, when green flag clicked to the script area. Drag the control block,
forever to the script area and put it to the green flag loc . rag the move block and put it
inside the forever block. Now, drag the if on edge, bounce block and put it inside the forever
block.
Now, put the control block if,then inside the forever block and snap the sensing block,
touching color in the hexagon of the if loop.
86 Computer Genius-V

