(^64) THE OFFICIAL RASPBERRY PI BEGINNER'S GUIDE
tick-box next to it – over the word ‘Hello!’ in your say Hello! for 2 secs block. This creates a
new, combined block: say loops for 2 secs.
set loops to^0
say loops for^2 secs
Click on the Events category in the blocks palette, then click and drag the when clicked
block to place it on top of your sequence of blocks. Click the green flag above the stage area,
and you’ll see the cat sprite say ‘0’ (Figure 4-6) – the value you gave to the variable ‘loops’.
5 Figure 4-6: This time the cat will say the value of the variable
Variables aren’t unchanging, though. Click on the Data category in the blocks palette,
then click and drag the change loops by 1 block to the bottom of your sequence. Next,
click on the Control category, then click and drag a repeat 10 block and drop it so that it
starts directly beneath your set loops to 0 block and wraps around the remaining blocks
in your sequence.
singke
(singke)
#1