Functions for kids: Gardens by the Bay

Teach the robot to plant a tree once, then reuse it across the garden.

Free · no sign-up · ages 6–12 · works on Chromebooks and iPads

What are functions?

A function is a set of instructions with a name. You teach the computer a new word once, like plant_tree, and from then on you can use that word anywhere. Functions stop you repeating yourself, and they make programs read like a story: "plant_tree, walk, plant_tree" is much easier to follow than a long list of steps.

In Gardens by the Bay, planting a tree always takes the same three steps: dig, plant the seed, then water it. Put those steps inside the "define" block once, then use the function block wherever a tree is needed. If you later find a mistake, you fix it in one place and every tree gets the fix.

Functions are how real software is built. Apps are made of thousands of small named pieces that call each other. The later levels combine functions with loops, the same way professional code does, and the "Show me the Python" button shows you the def keyword that Python uses to define a function.

Ready to Start Building?

Book a free 45-minute trial class. No commitment, no credit card — just great learning.