My Blocks#

My Blocks are used to create custom blocks.

My Blocks are used to create a sequence of blocks that can be used multiple times throughout a project.

My Blocks are made using the Make a Block button.

A rectangular button with rounded corners and a light gray border, labeled 'Make a Block' in bold, gray text, centered within the button.

My Blocks can have multiple parameters - text labels, numeric variables, and boolean variables - to add more functionality to your custom block.

A small, red, puzzle-shaped programming block labeled 'myBlock' in white text. The block is designed to connect with other blocks in a visual programming environment.

To use a My Block, attach the calling my block to a hat block. When the my block is reached in your project, the stack inside of the my block will run using the parameter values specified.

A red, rounded rectangular programming block labeled 'define myBlock' in white text. The block is used to define a custom function or block named 'myBlock' within a visual programming environment.

Note: Creating multiple My Blocks with the same labels and variables may cause errors when running your project in the Playgrounds.

In this example, a My Block is used to define making one side of a square. The My Block is then called 4 times to make all 4 sides of the square and finish the shape.

A visual programming sequence designed to make a robot draw a square. On the left, the sequence starts with a yellow 'when started' block followed by a yellow 'repeat 4' block, which repeats the actions inside four times. Inside the repeat block, a gray block with the text 'Make 4 sides to complete a square' and a red 'Make a square' block are placed. On the right, the red 'define Make a square' block defines the custom block. Inside this definition, there are instructions: a gray block that says 'Make the sides of the square 500 mm,' followed by a blue 'drive forward for 500 mm' block, and another gray block that says 'Turn right 90 degrees to make it a square,' followed by a blue 'turn right for 90 degrees' block. The sequence allows the robot to complete each side of the square.

My Blocks can also have custom parameters. In this example, the length of the square’s sides can be adjusted and will change in the My Block.

A visual programming sequence designed to make a robot draw a square, with an input for the square's side length. On the left, the sequence begins with a yellow 'when started' block followed by a yellow 'repeat 4' block, which repeats the actions inside four times. Inside the repeat block, a gray block instructs to 'Type in the length of the square's sides,' followed by a red 'Make a 500 square' block, indicating that the square's side length is set to 500 mm. On the right, a red 'define Make a sideLength square' block defines a custom block where 'sideLength' is an input variable. Inside this definition, the instructions include a gray block saying 'Drive forward for what the sideLength is set to in mm,' followed by a blue 'drive forward for sideLength mm' block. A gray block follows with the instruction 'Turn right 90 degrees to make it a square,' ending with a blue 'turn right for 90 degrees' block. This sequence allows the robot to draw a square with a customizable side length.