Level 1 · Complete beginner · 8 min
What Is Code?
Code is a set of very clear instructions you give a computer. This lesson shows you what that actually looks like.
What you will learn
- Say in your own words what code actually is
- Recognise that a computer only does exactly what it is told
- Read a tiny program and guess what it does
The idea
Code is a list of instructions. You write the instructions, the computer follows them in order, from top to bottom, without skipping anything and without guessing what you meant.
That is the whole idea. Everything else you will learn is just different kinds of instructions.
Why does this matter?
Computers are fast but they have no common sense. If you tell a person "add the numbers", they figure out the rest. A computer needs every step spelled out. Learning to code is really learning to break a task into steps that leave nothing to interpretation.
A real-world analogy
Think of a recipe. "Boil the pasta" is fine for a human cook. A computer needs: fill pan with water, put pan on heat, wait until bubbling, add pasta, wait 10 minutes, drain. Code is the second kind of recipe.
See it in code
let name = "Sam"; let greeting = "Hello, " + name; console.log(greeting);
Line by line
let name = "Sam";Store the text Sam and label it name, so we can refer to it later.
let greeting = "Hello, " + name;Glue the text "Hello, " onto whatever is inside name, and label the result greeting.
console.log(greeting);Print the result so a human can see it. console.log is how a program says something out loud.
What do you think happens?
What do you think this program prints?
Have a guess before you read on. Guessing wrong is part of learning it.
Try it yourself
Change the stored name to your own name and print a different greeting. There is no wrong answer here — this step is just to get your hands on the keyboard.
The proper words for it
- Program
- A file of instructions the computer runs from top to bottom.
- Statement
- One single instruction, usually one line.
- Output
- Anything the program shows you, such as printed text.
Where you'll meet this
Every app you use is this same idea at a much larger scale. When you tap Send in a messaging app, a list of instructions runs: check the text is not empty, send it to a server, show a tick. Same building blocks, more of them.
Lesson recap
- Code is an ordered list of instructions
- The computer does exactly what you wrote, not what you meant
- console.log prints something so you can see it
- Breaking a task into small clear steps is the real skill
Still fuzzy on any of this?
That's normal, and it's not a dead end. Pick a different way to hear it.
Quick check
1. In your own words, what is code?
2. Why does a computer need every step spelled out?