php · level 1 · unit 1 · lesson 1
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
is a list of instructions for a computer.
Code is instructions written down for a computer. A set of instructions that does one job, like a recipe for a cup of tea, is called a .
The computer follows a program exactly, starting at the top line and working down. It never guesses what you meant. It does what you wrote.
We will write our code in PHP, the language that builds many of the websites you visit. When you a program, the computer starts following it.
<?php
echo "Hello!\n"; Press run on this tiny program and the computer says Hello! back to you.
guess first
Spot the typo. What will the computer show?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
<?php
echo "Happy brithday, Gran!\n";
your turn
Your turn. Teach the computer a dance.
Make up a dance move and type it in place of the blank on line 3. Then press run and watch the steps appear in order.
fix it
Shoes before socks? Can you fix it?
- The computer runs the lines from top to bottom. Which one happens first here?
- Shoes first, then socks? Ouch. Lines 2 and 3 are in the wrong order.
- Swap lines 2 and 3 so the socks line comes first, then press run.
nailed it
you wrote and ran your first program. :D
- Code is a list of instructions for a computer.
- A program runs from the top line down.
- The computer does exactly what you write, not what you meant.
new words in your collection
- code
- program
- run
This lesson isn’t saved. A free account remembers every lesson you finish.