⌨️ Try It Yourself

Write your first lines of code right here — nothing to install, nothing to sign up for.

Each lesson has a box with a little program in it. Press Run to see what it does, then try changing it. You can't break anything: Start over puts the original back. (Tip: Ctrl + Enter also runs the program.)

These lessons use JavaScript, the language every web browser understands.

1. Say hello

The command say shows whatever you put inside the brackets. Words go inside quotation marks. Press Run, then change the message to your own name.

2. A very fast calculator

Computers are great at arithmetic. Use + to add, - to subtract, * to multiply and / to divide. Numbers don't need quotation marks.

3. Remembering things

A variable is a name for a value, like a labeled jar. let creates one. Change "Ruth" to your name and the age to yours, then run it.

4. Making decisions

if lets a program choose what to do. Try changing the temperature to 50 and running it again.

5. Doing things again and again

A loop repeats instructions. This one counts from 1 to 5. Can you make it count to 10? Or count by twos?

6. Put it all together

This program prints a times table using a variable and a loop. Change 7 to any number you like.

What's next?

You've just used variables, decisions and loops — the same building blocks behind every app you use. To keep going, see Getting Started With Programming for free places to learn, or read A Little Computer Science to learn how these ideas fit together.