Presentation is loading. Please wait.

Presentation is loading. Please wait.

Condition Switches between actions

Similar presentations


Presentation on theme: "Condition Switches between actions"— Presentation transcript:

1 Condition Switches between actions
V1 By Phil Bagge HIAS Computing Inspector / Advisor CAS Community Leader Author of the code-it resources Supported by

2 You need a partner Take turns to be the input and the output input – put information into program output – programmed actions Read the slide

3 Condition switches between actions
If partner says hop hop once Else Bow slowly If partner waves once Say Boo Raise right hand The condition is only checked once. If only there was a loop that went an all the time that we could use so that it continued to check the condition! Explain that the condition switches between two possible actions. You can only ever have the condition being met or the condition not being met. Both lead to actions. The first reveal indicates what is the condition and what are the actions Get pupils to act the first one out in pairs taking it in turns to be the input or output The second reveal gives another example for pupils to roleplay The third reveal points out that these algorithms are only checked once

4 Condition switches between actions
Loop always if touch shoulder bow slowly Else Hum Loop always if say bob wave once Else Smile Role play one of these yourself first. Get a pupil to touch your shoulder. While you are waiting for them to touch your shoulder say have they touched my shoulder over and over to simulate the loop. Pupils then act out this and the other one after the reveal. Can they say the condition over and over again? Including an always loop means the condition is checked over and over again

5 Condition switches between actions
Loop always if touch foot stand Else Sit Loop always if say go Jump once Else Wave If your class needs some more here they are. They might not so feel free to leave this slide. Including an always loop means the condition is checked over and over again

6 Condition switches between actions
Write your own condition switches between actions within a continuous loop algorithm Loop always if touch foot stand Else Sit One mark if it makes sense One mark if each action is on a new line One mark if you indent Get pupils to write their own one and roleplay it with a partner. Including an always loop means the condition is checked over and over again

7 Shapes Game Always loop if touching square hum Else Wave
if touching triangle hop Clap Write your own condition switches between actions within a continuous loop algorithm for the shapes Mark out these shapes on floor with masking tape. Pupils only do one algorithm at a time. They then write their own after the reveal.


Download ppt "Condition Switches between actions"

Similar presentations


Ads by Google