topic badge
CanadaON
Grade 8

Investigation: Branching and conditionals

Lesson

Another word for branching is conditionals. Conditionals tell you what to do based on certain conditions - or rules. For example, when getting ready to go outside, if it is raining you take an umbrella, if it's sunny you take sunglasses. The conditions here would be the weather - sunny or raining. What other conditions could there be? What would you put on if it was windy? What about it if was snowing?

Online: Bee Conditionals

Can you help cheer up this bee?

Try this game from code.org.  You will first learn how to tell the bee which way to go by writing an algorithm. Then you need to give them a conditional rule - to collect nectar if it is available or not. 

Questions:

Turn on the code instead of the blocks. How do they relate?

Where is the branching? 

Can you imagine what the flow chart would look like for this branching? Try sketching it out. 

 

Unplugged Classroom Activity

Can you think of any games you play that have branching rules? 

Can you create any games where the rules involve conditionals?

Your teacher can use this pdf to help you get set up.

Outcomes

8.C3.1

Solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves the analysis of data in order to inform and communicate decisions.

8.C3.2

Read and alter existing code involving the analysis of data in order to inform and communicate decisions, and describe how changes to the code affect the outcomes and the efficiency of the code.

What is Mathspace

About Mathspace