As shown in the following figure, the area in the red box is the Blocks area where multiple categories of blocks are provided for programming.
For details about how to use each block, right-click a block and choose Help.
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. Programs (or scripts) in mBlock 5 are compiled by connecting different types of blocks vertically like a jigsaw puzzle. mBlock 5 provides blocks of five shapes, as described in the following:
- Hat blocks
- Stack blocks
- Reporter blocks
- Boolean blocks
- Cap blocks
1. Hat blocks
A hat block is used to start a script and is always placed on top of other blocks. Generally, a hat block looks like the following.
Each hat block uses its own way to activate a script, and therefore scripts can be executed separately at different time points.
2. 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 at the bottom. Generally, a stack block looks like the following.
Stack blocks are used to execute the main commands, and therefore are the majority among all the blocks.
3. 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.
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 slot fits.
4. 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.
A boolean block must be put into the hexagonal slot of another block. It can't be used independently.
5. Cap blocks
A cap block ends a script or program. It can only be put under all other blocks. Generally, a cap block looks like the following.