If a function returns a given value, then that function will appear as a value block so that the value it returns can be used in other blocks, like this:
Thanks for your reply.
Well, I do see these also, but as soon as I “add” the block to the project the “output” disappears.
Or if I have created a function with a return block from start, I won’t be able to just call it later, I need to add it as an “output”…
See what I mean?
If I use the simple “create function-block”, without any return - I can call this to any block later.
If I create a function WITH return, I can not call that in the same way as the other function, I need to “add” it as an output/value somewhere…
If I creat a simple function without return and then ADD a return block to that function, the “output-opening” is closing, so I can’t add anything there later on…
Please see video shot here:
I am sorry for my bad “code-languish”, I am not sure how to formulate my self.
Maybe this is a completely normal behaviour, it’s just that I don’t understand it… So I need to ask.
Does it help to know that you can change a variable (any variable’s) value from within a standard function?
The function with return block is really only for times when you need to have the returned value immediately available as a block. Otherwise, you can just use the standard function block.
I’ve never used the standalone “return” block in a function. I’m honestly not sure what it does.
For example, I might say “I want to calculate the square root of a number the user types in” or “I want to sort a list I have stored in a variable in reverse order.”
What is it you’re actually wanting to do with functions?
Thanks!
Yea, I want to loop/repeat my call for my data list until there is something in the list, and if there never gets anything in that list (It’s empty) I want to “break” that loop after a wile by just RETURN to my empty list…
In this video, you drag out a function that does not return a value.
Can you drag out the second function block, that does contain a return block, and see if that works in your app? It’s called ‘do something and return’ in this video.