LEARN.PARALLAX.COM
Published on LEARN.PARALLAX.COM (https://learn.parallax.com)
Home > Functions

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.

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024


Source URL:https://learn.parallax.com/reference/scribbler-3-robot-block-reference/functions-2/
Links