AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Shapes that show steps

Week 1 · Unit 1: Go with the flow · 3 lessons
3

Loops and decisions

Computing 6: Unit 1, pp. 8–21
GoalExplain how a loop and a decision change the path through a flowchart, and count the outcomes.
New words
loop · a part of a flowchart that repeatsforever loop · a loop with no way out, so it never stops by itselfdecision · a diamond that asks a yes or no questionbranch · one of the two paths that leave a decision
Explanation

Some jobs repeat. In a flowchart, an arrow that goes back up to an earlier step makes a loop. A forever loop has no way out, so it never stops by itself. Most loops contain a decision. The decision asks whether to go round again or to leave. A decision is a diamond with two arrows leaving it, marked yes and no. Each arrow is a branch. A flowchart with one decision has two possible outcomes, because the path depends on the answer.

Starttake an empty jug and a cupjug under 3 cups?yespour in one cup of waternoshow: the jug is readyEnd
Worked examples
Startlook out of the windowis it raining?yesnotake an umbrellawear a hatEnd
Lola’s flowchart has one decision, so it has two outcomes. If it is raining she takes an umbrella. If it is not raining she wears a hat.
light onwait 1 secondlight offwait 1 second
A lighthouse light flashes all night. Its flowchart is a forever loop: the last step sends the arrow back to the first one, and nothing ever ends the loop.
CheckCups in the jugUnder 3 cups?What happens
10yespour one cup
21yespour one cup
32yespour one cup
43noleave the loop
Following the jug flowchart step by step shows how the loop works. The question is asked again after every pour. The loop stops when the answer is no.
Class activity

Human flowchart (no computer): lay a line of tape on the floor four big steps away from you. Make cards: an oval ‘start’, a rectangle ‘take one step forward’, a diamond ‘Are your toes touching the tape?’ and an oval ‘stop’. Stand on the start card. An adult points to the cards in the order of the arrows. Answer the diamond question honestly each time. If the answer is no, you take a step and go back to the diamond. If it is yes, you stop. How many steps did you take? Move the tape closer or further away and try again.

Practice
1
The stack starts with 2 books. How many books are added before the flowchart ends?
Startunder 5 books?yesadd one booknoEnd
2
Draw a flowchart for this game: toss a coin and ask ‘Is it heads?’. If yes, say ‘You win’. If no, say ‘Try again’. How many outcomes does it have?
3
What does the person wear when the temperature is 20 degrees? What do they wear at 15 degrees?
Startread the temperaturetemperature below 15?yesnowear a jacketwear a T-shirtEnd
4
A flowchart keeps adding 1 to a counter until the counter is 5. The arrow from ‘add 1’ must go back to a step. Which step, and why?