Coding Conditionals in App Inventor

When you code a mobile app, you sometimes want the app to do different things, depending on what is happening in the app.
For example, in the Recycle Game in Unit 5, you used an if-then-else block to add 1 to the score if the user pressed the correct button. Else, the app subtracted 1 from the score.
if else block
The video below helps to explain the different types of conditional blocks, which are blocks that cause different actions depending on a condition.
The girl is using a different coding language than App Inventor, so the blocks look a little different and have different colors, but the ideas are the same.

Mobile game apps are really fun and can be a great way to educate users about big problems!


Follow the 4 videos below to make a game where a diver will race against a fish to pick up plastic in the ocean.

This is what the game looks like when finished.

Ocean Plastic Cleanup

4 Videos
Extra Information

You will learn a lot about the Canvas and ImageSprite components in the video,  but if you want to skip the video and get right to coding, you can load the template file in App Inventor.


You made a mobile app game and learned all about conditional blocks. You also got practice with making a procedure which is really useful when coding!

What ways can you improve or add to the OceanPlasticCleanup game?

Try adding one new feature – an animated plastic bottle, multiple fishes, sounds…

What else can you add?