Block Reference

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.

1596422161675-afc85372-ad79-4f6e-8e14-a13a51476c5a.png

For details about how to use each block, right-click a block and choose Help.

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. 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.

1589420766792-0943d55f-3169-46c6-ac5f-5abb28df959c.png

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.

1589420766691-ee871dac-ba85-4d95-af6c-0e8b066ecced.png

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.

1589420766831-821f4a70-8b8d-4e99-ac5e-6e4c12579dde.png

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.

1589420766720-1ac9fab6-56b5-4076-8465-4691e04446ed.png

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.

1589420766705-65f095ce-e0bf-4be6-a785-f24d4cc1472d.png

 

Was this article helpful?
23 out of 29 found this helpful

Comments

0 comments

Please sign in to leave a comment.