Crayonbird
Menu

Computing

What is coding?

Quick answer

Coding, or programming, means writing instructions in a language a computer understands so it can do a job, like run a game, an app or a website.

Ages 6–14Primary

In one sentence

Coding is writing instructions, called code, that tell a computer exactly what to do.

Explained

Computers are fast, but they only do what they are told. Coding is how we tell them. First you plan the steps, which is an algorithm. Then you write those steps in a programming language. The finished set of instructions is a program. Apps, games, websites and even washing machines run on programs.

There are two main ways to code:

  • Block-based coding: you drag and snap together blocks like puzzle pieces. Scratch, created at the MIT Media Lab, is a popular example. It is great for starting out because you cannot make spelling mistakes in commands.
  • Text-based coding: you type commands. Python and JavaScript are common examples. Text code is what most professional programmers use.

Whatever the language, the same big ideas appear:

  • Sequence: instructions run in order.
  • Loops: repeat instructions.
  • Conditions: "if this, then that".
  • Variables: named boxes that store information, like a score.
  • Events: something that starts code, like clicking the green flag or pressing a key.

Code rarely works perfectly first time, even for experts. Finding and fixing mistakes is called debugging, and it is a normal part of coding. Deep inside, the computer turns everything into binary: patterns of 0s and 1s.

  • computer
  • robot
  • rocket
  • blocks
Coding can make a sprite dance, a robot move or a rocket game fly.

Examples

Block code (Scratch-style):

  • when green flag clicked
  • repeat 10
  • move 10 steps
  • turn 36 degrees

The same kind of idea in Python:

Python line What it does
score = 0 makes a variable called score, starting at 0
for i in range(5): repeats the next lines 5 times
score = score + 1 adds 1 to the score
print(score) shows the score on screen

Unplugged coding works too: write arrow cards (forward, left, right) and "program" a friend to walk through a maze on the floor.

Common mistakes

  • Typing errors in text code. Capital letters, brackets and colons matter. Check carefully.
  • Giving up when it breaks. Every coder's program breaks. Test small parts often.
  • Copying code without understanding it. Change one thing at a time and predict what will happen.

Quick quiz

Coding

Check what you know with 4 quick questions.

Question 1 of 4

What is a program?

Practise it

Try it

Code and logic puzzles

Ages 11–13

Number sequences · Warm-up

Ages 13–18

Binary and hex · Tricky

Ages 15–18

Number sequences · Expert

See more in the library

All Logic and code puzzles sheets

For grown-ups

Algorithm

An algorithm is a precise, step-by-step set of instructions for solving a problem or doing a task. Computers follow algorithms written as code.

Computing · Ages 5–12

Debugging

Debugging means finding and fixing mistakes, called bugs, in an algorithm or a computer program. It is a normal part of coding for everyone.

Computing · Ages 6–14

Binary

Binary is a number system that uses only two digits, 0 and 1. Computers use binary to store and process all their information.

Computing · Ages 9–14

Online safety

Staying safe online means keeping personal details private, using privacy settings and strong passwords, being kind, and telling a trusted adult if anything worries you.

Computing · Ages 5–14

Growth mindset

A growth mindset is the belief that abilities can improve with practice, good strategies and help. A fixed mindset is the belief that you either have a talent or you don't.

Study skills · Ages 6–16

Back to the Learning Wiki