AI or coding first: which should your child learn?

Coding Education

Hafiz Rahman
Lead Coding Instructor at Algonova Malaysia

A constant is a fixed value in a program that never changes while the program runs — the opposite of a variable. Once you set a constant, its value stays the same from start to finish. Programmers use constants for numbers and text that should stay locked, such as the value of pi, the number of days in a week, or a game's maximum score.
Table of Contents
A variable is a labelled box whose contents can change; a constant is a box that has been sealed shut. Both store data, but only a variable can be updated later. In Python, programmers write a constant's name in capital letters to signal "do not change me":
PI = 3.14
radius = 5
area = PI * radius * radius
Here PI is a constant — 3.14 never changes — while radius is a variable you might update for a bigger circle. In Scratch, a constant is like a number you type directly into a block, while a variable sits inside a named block you can change at any time. Fun fact: many languages, such as JavaScript and C++, have a special keyword (const) that stops a constant from being changed by mistake.
Common constants include the value of pi (3.14), the number of days in a week (7), the maximum number of players a game allows, or the speed of light in a science app. A tax rate, a screen width, or a company name shown on every page can also be stored as constants. In each case the value is decided once and reused, so the program stays consistent and a coder never risks typing a slightly different number the next time it is needed.
Understanding constants helps children write clearer, safer code and see the difference between data that stays put and data that moves — a core idea in STEM and Malaysia's KSSR computational-thinking lessons. Constants also make programs easier to read and fix. Kids can practise this hands-on in Algonova coding classes, and it pairs naturally with learning what a variable is.
Curious minds can try a free trial class and write their very first constant.
A constant is a fixed value that never changes while a program runs. Unlike a variable, its value is set once and stays the same, which keeps important numbers like pi or a maximum score safe from accidental edits.
A variable can change its value as the program runs, while a constant cannot. Use a variable for data that updates (like a score) and a constant for data that must stay fixed (like the number of days in a week).
Yes — in Python, PI = 3.14 is a constant because 3.14 never changes. Other everyday examples include the maximum number of players in a game or the speed of light.
Constants make code easier to read and help prevent mistakes. Naming a value once (like PI) and reusing it means you never accidentally type the wrong number, and other people can understand the code faster.
Start your child's tech journey
Book your free 60-minute trial class with an Algonova certified tutor. No payment, no obligation, just discover what your child can build.