
Coding Education
What Is a Loop (Perulangan) in Programming?

Bayu Nugraha
Children's Coding Specialist

A loop (perulangan) is a programming instruction that tells the computer to repeat a single command or block of code automatically, many times over, without having to write the same command again and again. Loops make programs shorter, cleaner, and much faster to build.
Types of Loops
Two kinds of loop are most common. A for loop is used when the number of repetitions is known in advance, such as "repeat exactly 10 times." A while loop is used when the repetition should continue as long as a condition stays true, such as "keep running while the player's score is under 100." Both stop the moment their task is finished.
In Scratch, a child can see how a loop works through the "repeat 10" block: one small block replaces ten separate commands. Imagine drawing a square. Without a loop, a child has to write "move, then turn" four separate times. With a repeat 4 block, one command is enough, and the character on screen draws all four sides on its own. In a large program, a single loop can save hundreds of lines of code.
Why It Matters for Kids
Loops are one of the first concepts taught in coding because they train children to think efficiently: to spot a repeating pattern and simplify it. This pattern-spotting skill is useful not only at the computer, but also in math and everyday logic. In the Algonova coding course, children learn loops through Scratch projects they can run and play with right away.
Try a free class and watch your child build their first program using loops.