Honk your horn with a button on Code Car. What sounds will you make?
How many can you complete? Change the code according to the challenges below. Upload your code to see the effect when you're finished. Complete a challenge? Check it off the list!
New Concept: Continuing with 'if' statements
The 'if' statement is worth spending another lesson on, since it changes the entire way you can think about programming. Code Car only has one type of physical input- the button, but you can trigger any sort of output with it.
To put it another way, anything that you can run inside a void loop, you can also run inside an 'if' statement. It could be one line of code or it could be 20 lines of code - there is no limit. When you do that, the code inside the 'if' statement only runs when a certain condition is true. If you didn't get enough challenge out of this lesson, think about some of the code in previous lessons, like songs, that you could now trigger with an 'if' statement.