how do you use the function with return block.
I watch the tutorial but still don’t understand.
A function can do two main things: (1) It can run code blocks and (2) it can return a value.
You might use this is you are finding the smallest number in a list of numbers. So the input to the function would be a variable containing a list of those numbers. And the output (return) would be the smallest number. The code inside the function would do the work of determining which list item (number) is smallest.
Here’s a representation of that process:
{3,5,1,7,8} → 1
Once created, you would use the function like this:
Set label’s text to smallestNumberFunction [app variable listOfNumbers]
Functions are a little like “black boxes” in math:
For that function, the input is 3 and the output (return) is 9. The function does the work to square the input. A function might have a few blocks or dozens of blocks depending on what it does.