0 – Block Shapes

Block Shapes

The blocks are designed in different shapes, each indicating one data type. The blocks can be connected to each other vertically like a jigsaw puzzle. mBlock adopts and improves the block shape reference from Scratch. There areĀ of five shapes, as described in the following:

  • Hat blocks
  • Stack blocks
  • Reporter blocks
  • Boolean blocks
  • Cap blocks

Hat blocks

A hat block is used to start a script and is always placed on the top of other blocks. Generally, a hat block looks like the following.

image

Each hat block uses its own way to activate a script, and therefore scripts can be executed separately at different time points.

Stack blocks

A stack block is a rectangular block that can fit on or under other blocks, with a notch at the top and a bump on the bottom. Generally, a stack block looks like the following.

image

Stack blocks are used to execute the main commands, and therefore are the majority among all the blocks.

Reporter blocks

Each reporter block contains a value that can be a numerical value or character string. Generally, a reporter block looks like the following.

image

A reporter block can be used in any script that requires data but can’t be used independently. A reporter block can be fit into another block as long as the slots fit.

Boolean blocks

A boolean block contains a condition, which can be either “true” or “false”. Generally, a boolean block is an elongated hexagon as shown in the following.

image

A boolean block must be put into the hexagonal slot of another block. It can’t be used independently.

Cap blocks

A cap block ends a script or project. It can be put only under all blocks. Generally, a reporter block looks like the following.

image