Conditional+Statements+(Scratch)

So far you have learned how variables work, and how to produce arithmetic calculations. All the code you have written so far is executed in **sequence** - each line of code gets run after the previous one.

The next step is to understand how we can program a computer to make a decision e.g.


 * If a person's age is over 12 then display a message
 * If a game character touches the fire then lose a life
 * If the password has less than 5 characters then display an error message

We can write decision making code using **IF...THEN** statements or **IF...THEN...ELSE** statements. These are also known as [|conditional] statements. And IF...THEN..ELSE statement takes the form:

If condition A is true Then Perform Action X Else Perform Action Y End If

Here is an example of an If...Then...Else statement in Scratch:



Now complete the following exercises

Temperature

Guess My Number

Who Wins?

Design your own program

Games Design Extension Projects
The Maze