0.2 — What is a program?
A program is a list of steps#
A program is a list of steps that a computer follows. In order. One at a time.
Think of a recipe:
- Get a bowl.
- Add flour.
- Add water.
- Mix.
A computer program works the same way. It just has different steps, like "show this text" or "add these two numbers".
The steps of a program, written in a language the computer tool can understand. Writing code is also called programming or coding.
Computers are fast, not smart#
A computer does exactly what you tell it. Nothing more. Nothing less.
If you tell it to do something silly, it will do the silly thing, very fast. That is why we must be clear and exact when we write code.
The computer never guesses what you meant. It only does what you wrote.
Programming languages#
Computers only truly understand machine code: long lists of 0s and 1s. That is very hard for people to write.
So we write in a programming language instead. It looks a bit like English mixed with math. A special tool then turns our code into machine code.
int score = 10 + 5;Even if you do not know C++ yet, you can probably guess: "make a score that is 10 plus 5".
Tip: press ← / → to move between lessons, / to search.