Skip to 0 minutes and 16 secondsLast week you learned about operators and variables. If you had any troubles, any problems with it, you can go and get the code base and copy and paste the game code into your own development environment so that you get up to scratch. But you really should look into them because they are fundamentals and you will have problems if you don't understand. This week is conditional week. Up until now we've been looking at programmes where we do things step by step, one line after the other in a linear fashion. But the world is not linear. We know this. For instance every morning, before going to work, I'll look out-- is it raining? And If it is, I'll take the car.

Skip to 1 minute and 1 secondBut if it isn't, I'll use my bike. Also when I pass a road. I won't just walk out and pass the road. No, I'll look-- is there traffic? And if there is, I will not possible because I'll die. I create rules like this. In programming we do the same. We have conditionals. We create rules for the behaviour that we want in our programme, so that it does what we want it to do. It's called IF statements. And in IF statements, we have Boolean values. It's actually based on Boolean logics. So we can get a true or false value and based on that we'll do whatever is appropriate.

Skip to 1 minute and 42 secondsSo if something is true, we'll do one thing, and if it's false, well we'll do something else. That's what we'll look at this week.

Welcome to Week 3

In this video we’ll cover the basics of conditional statements and how to use them to improve the game. You’ll also learn about Boolean expressions and how these help the program to ‘decide’ what to do.

Once you’ve watched the video, it’s a good idea to download and follow the steps in the Guide to setting up for Week 3. This will give you a clean code base to work on through the week. If you want to save a version of your current code, this blog post will guide you.

If you get stuck at any point please refer to the comments in case anyone has experienced the same problem. If you find a useful answer, please ‘like’ it to make it easier for others to find.

Don’t forget that you can also revisit the glossary to help you understand any new words and phrases you may come across in the course.

Answers and explanation to last week’s exercises

If you struggled with Week 2 exercises, have a look at Karsten’s blog post.

Share this video:

This video is from the free online course:

Begin Programming: Build Your First Mobile Game

University of Reading