Your First Program
A program is just a list of steps. Build one that looks at a number and decides what to say.
Three small ideas
Every program, even the giant ones, is built from pieces this simple. Here are the three you need today.
A program is a list of instructions. The computer reads them in order, from the top
down, and does exactly what each line says. No more, no less.
A variable holds a value. Think of a variable
as a labelled box. We will use one called score
that holds a number you choose.
An if/else makes a decision. It asks a
yes-or-no question about your value. If the answer is yes, it does one thing. If no, it does the other.
Build it, then run it
Set the parts below. The program reads itself out as you go. Hit Run to see which line wins.
1 · the variable score holds this number
5
2 · the question the if asks
score
?
3 · what to show
if yes:
if no:
The screen
Press Run to start.
The computer never reads your words as commands. It only checks the number, picks a branch,
and shows the message you wrote. Your messages are just text, so they are always safe.
To earn the badge, make both branches happen: a score that wins, and a score that loses.
Made the win line fire
Made the try-again line fire
← The Foundry · every fact here is real, kept simple. The program only ever checks your number, it never runs your words.