Assemble working scripts from shuffled lines — functions, choices, loops, and events — without typing a thing.
Reading code and writing code are different skills — and this lesson drills the one in between: ordering. Each activity shows the lines of a working script shuffled up, with a few imposters mixed in. Tap the right lines in the right order, leave the fakes out, and you've built the script. No typing, just judgment.
Code runs top to bottom. So ask yourself at every line: does this need something that only comes later? A variable must be declared before it's used. A function must be defined before it's called. An end must close what a function or if opened.
Let's warm up with a function:
A conditional checks top to bottom. Decide the order so the right branch wins for a score of 75.
A for loop knows exactly how many laps it runs. Arrange it.
Events don't run now — they register for later. Order the connect correctly, passing the function itself, not a call to it.
You just arranged four scripts — a function, a choice, a loop, and an event. Notice the skill you used: you read a script as a sequence, in your head, and checked every line against the ones around it. That's exactly how you'll read real code when something breaks.
You're arranging lines and one uses coins before declaring it. Where should the declaration go?