Functions

The FUNCTIONS blocks in BlocklyProp are used to create or use program functions.


define function

The define function block is used to build a function that can be reused. This block (and the enclosed group of blocks it contains) are separate from the main program.

  1. Enclose a group of blocks that you want to re-use within the define function block.
  2. Next, give the function a name in the my function text field.

Once you have created a function, a run function block will be created for it and will appear in the FUNCTIONS menu.


run function

The run function block runs the code inside of a define function block by the same name. In coding, this is referred to as "calling a function" or "making a function call."  You must first create and name a function with a define function block to generate a run function block.

You can use a run function by placing a run function block into your main program. This block can be used multiple times in the same program.