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

Reuse with sub-routines

Week 14 · Unit 6: Sub-routines in programming · 3 lessons
Answers are for parents and teachers.
1
Write the sub-routine ‘Draw Rectangle’ for a rectangle 60 steps long and 30 steps high. Then write a main algorithm that draws two rectangles with a gap of 20 steps.
2
Find the steps that repeat and rewrite the algorithm with a sub-routine called ‘place one chair’. 1 Pick up a chair. 2 Carry it to the row. 3 Set it down. 4 Pick up a chair. 5 Carry it to the row. 6 Set it down. 7 Pick up a chair. 8 Carry it to the row. 9 Set it down.
3
Trace the program. Where does the sprite end?
Sub-routinedefineslidechange x by25change y by-5Main scriptwhenclickedgo to x:-50y:30sliderepeat4
4
Tell someone at home what a sub-routine is in your own words. Give one example from daily life where a set of steps is used again and again.
5
(if you have a computer or tablet) Build ‘draw dash’ in Scratch and draw a dotted line with the repeat block. Change the number of repeats and see what happens.