Step 8 of 10 · G · Boxes working together
Two boxes work together, in code
×
Remember the × machine? Two boxes feed in, one box catches the result.
Step 1 / 22recall
let score = 100;
let bonus = 3;
let total = score * bonus;
console.log(total);Output
300
We saw the × machine — two boxes feed in, one number drops out.
In code, that whole picture is three lines.
Line 1 makes the box
score. Line 2 makes the box bonus. Line 3 makes a new box total and puts score * bonus into it.That third line carries the heartbeat of every program: read some boxes, transform the values, store the result.
The math symbol for multiply in code is
* — the keyboard star, not the printed ×. Computers stick to symbols you can type.After this code runs,
score is still 100 and bonus is still 3 — they are not changed. Only total is new.The names on the right of
= are read. The name on the left of = is written to.Same shape across all five languages — three lines, same rhythm — only the keyword and stamp dressing changes.
In
py, you skip the keyword entirely: total = score * bonus.In
php, every box still wears the $: $total = $score * $bonus;.This little pattern — read, transform, store — is the heartbeat of every program you will ever write, no matter how big.
Check yourself
Predict the output
js
let score = 100;
let bonus = 3;
let total = score * bonus;
console.log(total);What does this print?
Quick check
What does `*` mean in code?
