MISSION 9
A Lock to Protect Your Sword
We want to keep our sword from Mission 5 safe. Unlike the door in your room, the sword can be anywhere at any time. We want to put a lock on the sword, and if anyone tries to move the sword, an alarm will go off, and the sword won’t work. This alarm can go on anything that you want to keep safe, not just the sword.
You don’t need a speaker for this mission, because the lock will stop the sword from working. We’re going to use if and else statements.
ELSE
We briefly saw an else back in the Debug section of Circuit Playground Express in Mission 3. It covers everything the if doesn't. Remember the algorithm:
What do we do if Lorraine is not hungry? That’s where else comes along.
Only one of these actions ...
Get Save the World with Code: 20 Fun Projects for All Ages Using Raspberry Pi, micro:bit, and Circuit Playground Express now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.