12 Scratch Project Ideas for Primary School Kids: From Simple Animations to Games

Coding Education

Bayu Nugraha
Children's Coding Specialist

A function in programming is a named block of code written once and then called many times to perform a specific task. Unlike a function in mathematics, which turns one number into another, a programming function holds a set of reusable instructions so you never have to write the same code twice.
Table of Contents
A function is created with a name. Each time that name is called, the program "jumps" to the function, runs everything inside it, then returns to continue with the next line. Functions can also take inputs (called parameters) and return a result.
Imagine a child building a "jump" block in Scratch that makes their character leap. Once the block is made, it can be reused anywhere without rebuilding it. In Python, the same idea is written as def jump(): and then called simply with jump(). One function can be called hundreds of times — so a program that once had 100 repeated lines can shrink to just a few clean, easy-to-fix lines.
A function becomes far more useful when it can take input and give back a result. The input is called a parameter, and the value it hands back is called the return value. For example, in Python a function area(length, width) takes two parameters and returns length * width. With this single function, a child can work out any area just by changing the numbers, without writing the formula again and again. A function that only runs commands without returning a value is sometimes called a procedure. A child can write their first function like this in a free Algonova coding class.
Functions teach children to break a big problem into small, orderly pieces — a way of thinking that's useful far beyond coding. By understanding functions, kids learn to write clean, readable code from the start and avoid confusing repetition. This concept is one of the foundations in the Algonova coding course, where children practice building programs from simple blocks and functions step by step.
Want your child to try it hands-on? Sign up for a free class and watch their first function come to life.
A math function turns one number into another through a formula. A programming function is a block of instructions you can call again to do any task — printing text, moving a character, or calculating something.
Children around 7–8 can grasp the idea of functions through visual blocks like those in Scratch. Text-based functions, such as in Python, usually suit kids aged 10 and up.
Functions make code shorter, cleaner, and easier to fix because you don't repeat it. They also train children to think in a structured way by breaking a problem into small parts.
Making one "greet" function that shows the text "Hello!". Once created, it can be called anytime without rewriting the text.
Blog