Blocks and code

Try itYour first script

A script can show in two ways. Code Code shows it as words. Blocks Blocks shows it as coloured blocks. It is the same script both ways.

Switch to Blocks

Press Blocks Blocks, at the top left of the code box.

In CodeIn Blocks
The when line is at the top.The when line is a big block.
The steps are pushed in under it.The steps sit inside the big block.
You click a number to pick a new one.You press - and + beside a number, or type a new one.

Change a number in Blocks

  1. Find the first 4, the one beside seconds.
  2. Press - until it says 2.
  3. Press Play Play this script. The slime walks left twice as fast.
  4. Press Stop Stop.
  5. Press Code Code. The first walk line now says over 2 seconds.

You changed the block, and the words changed too. That is because there is only one script.

Which one should you use?

Use the one you like. Blocks are good when you are new, because you can not spell a word wrong. Later in the course you will type scripts, so look at Code now and then.

This section ticks itself when you press Play Play this script.

Press Play in the code box to finish this section.