Subroutines: Reuse Your Code
Programs & Judgement · subroutines · name a block of code and reuse it

Kavi Teaches the Robot One Trick
Kavi's robot had to wave hello to ten friends. "I am NOT writing raise, shake, lower ten times!" hooted Kavi. So Kavi taught the robot one trick and gave it a name: define wave(): raise · shake · lower. Now Kavi just writes wave() and all three steps run. "A named block of code I can run again and again is a subroutine," said Kavi. "I define it once, then call it as many times as I like — and if I want to change the wave, I fix it in one place, not ten."
What your child will learn
A peek inside
Try this at home: A named block of code that you can run again and again is called a ____.
Ready to play and learn?
Start the free interactive lesson, or print the handout for screen-free play.
Part of Computing · Stage 5 · S5 on KAVI Academy — a secular, whole-child learning platform for ages 5–12.
