Skip to content
Your progress

Checking your sign-in…

Who's learning?

Each profile keeps its own read lessons, badges, streak, and practice scores on this device.

Lesson 10 of 11

8 min

Text size

Keep this table open beside the editor while you answer.

Eight lines to keep beside you the first time a program is something you type
IdeaThe line to keep
Typing it outA typed program runs one line at a time, from the top. The lines run in the order you wrote them.
let and constlet can be given a new value later. const cannot. The machine stops the run if you try.
Four kinds of valueThe kind of a value is what the machine holds. It is not how the writing looks. Run it and ask: number, text, true or false, or nothing?
What the signs doThe signs do arithmetic on two numbers. + joins instead when one side is text. The other side must be something that can be written out. A nothing cannot be written out. In this editor, text plus nothing stops the run.
A fork in the lineAn if runs its block only when the condition is true. In this editor, the condition must be true or false. A number or text there stops the run.
Until it stopswhile checks its condition, runs the block, and checks again. Something inside the block must change what the condition asks about. Otherwise nothing ever ends it.
Once for eachfor (const item of list) runs once per item. The number of turns comes from the list, not the block.
What the message saysAn error message names the line the run stopped on. It says what could not be done there. The cause can be on that line or above it. Fix one thing, then run it again.

Two print lines are swapped. What changes?

  • The order of the output
  • Nothing. Both lines are still there.
  • The program stops.

What do the quote marks in print("Canal Bridge"); do?

  • They make the words look different.
  • They repeat the line one more time.
  • They mark the exact characters.

Which word makes a box you can refill later?

  • `const`
  • `let`
  • `print`

const seats = 32; and later seats = 40;. What happens?

  • The run stops and names `seats`.
  • `seats` becomes 40, and the run goes on.
  • `seats` becomes 72, as 32 plus 40.

waiting holds 18. Then waiting = waiting + 6; runs. What does it hold?

  • 6
  • 18
  • 24

What does "12" + 8 give?

  • `20`
  • `"128"`
  • It stops.

What kind of value is "true"?

  • text
  • true or false
  • nothing

What does 45 * 3 + 12 give?

  • `2025`
  • `57`
  • `147`

In this editor, what does "Total: " + chalk do when chalk holds nothing?

  • It prints `Total: 0`.
  • The run stops.
  • It prints `Total: `.

mm is 60. What does mm >= 60 give?

  • `true`
  • `false`
  • `60`

In this editor, a learner writes if (mm) { ... } and mm is a number. What happens?

  • The block runs, as any number counts as true.
  • The block is skipped, as a number is no answer.
  • The run stops. It needs true or false.

A queue of 96 halves each round until it is under 10. How many rounds?

  • 3
  • 4
  • 6

A while loop starts with a true condition. Its block never changes what the condition asks about. What happens?

  • The machine stops it at the limit.
  • It ends after exactly one turn, quietly.
  • It ends by itself after a few turns.

A list holds 3 stops. How many turns does for (const stop of stops) take?

  • 1
  • It depends on the block.
  • 3

The list is empty. How many times does the block run?

  • Once
  • 0 times
  • The run stops.

An error message says line 3. What do you do first?

  • Rewrite the whole program from the top.
  • Close the editor and walk away for now.
  • Read line 3, then look above it.

That is the track: type it, run it, read what comes back.

Next: Computational Thinking III: Functions & Debugging.

Reveal every answer to finish this lesson.