Raspberry_Pi_Education_Manual

Notes:

Before we move on to the next step, take your second “if/else” block and place it inside the “else” bracket of your first “if/else” block: the one you used to find out if the dog wanted to go on holiday.

Your script should now look like the block of code in the screenshot above.

Over to you

Question: What will the cat say if the dog’s age is 9? Question: What will the cat say if the dog’s age is 12? Question: What will the cat say if the dog’s age is 10?

Where does the dog want to go?

To be fair to the dog, we should let her choose where to go on holiday. We will give the dog three possible holiday destinations: Australia, France and the USA. To keep it simple, we won’t ask the dog to enter the country’s name, just the initial letter. Using the information you can see in the screenshot below, add blocks to your script to make it ask the dog where she wants to go on holiday. Store the dog’s answer in the variable “country”.

You will need blocks from Looks, Sensing and Variables. Place them in the “else” bracket of your second “if/else” block.

A beginner’s guide to Scratch

32

Made with FlippingBook flipbook maker