To create a function, you will need to specify if it has any inputs and give it a name
One example of a function is below, featured in our Social Credit sample app
After you have created your function, you can simply use it at any time using the function block you have named
You can also create a function that returns a specific output.
You can add multiple
return blocks to your function. This allows you to return a different output based on some conditions.
For example, this function will take a rating out of 100, and return a description of the quality of the item being reviewed:
The function will break when the
return block is fired. For example, in the above example, if the quality rating is 100, the function will return Perfect and then stop. It will not run the other tests, and won't return Excellent. Good, Fine, etc.