Dark theme

Scratch basics: some useful types of blocks

Note that all the blocks below can be found by looking at their colour and then clicking on the same coloured Block Set:

Screenshot: Block sets

 

1) Variable blocks: you make and name these blocks yourself. They can hold numbers or words, or lists of these things. The "name" block: Screenshot: variable block in the example on the last page is a variable.

 

2) Operator blocks: these are used for doing maths or comparing things. The "equals" block: Screenshot: equals block in the example is an operator block.

 

3) Branching blocks: these are used for making decisions in the code that cause one or more other bits of code to run. The classic blocks are the "if" block in the example above, and the "if-else" block:

 

Screenshot: If-else block

 

Here the program makes a "meow" noise if the variable "name" contains the word "Joe", but plays a drum if not. It then always goes on an moves 10 steps.

 

4) Looping blocks: these repeat the same bit of code over and over again. Examples include looping forever and looping until something is true.

 

Screenshot: Loop blocks

 

5) Most other code blocks are procedures which do something or get some kind of data. The sound producing blocks above are examples.

 

Go back to the tutorial page.