Functions

A set of blocks that allow you to create and call functions. Functions are handy for structuring and reusing repetitive logic

You can define functions with or without a return value

You can define functions that accept parameters as input arguments

You can add a description to any function

Once you have defined a function, blocks will appear in the “Functions” section to call it

A block for calling a function without parameters that does not return a value

A block for calling a function with parameters and a return value

Example

Let’s create a function that calculates the length of the hypotenuse. It will take the length of the legs as parameters

Simple functions like this can be written shorter - move the hypotenuse calculation to “return”, and in the function settings uncheck “Allow operators”

Function call