i've watched several videos and read all the wiki articles about it but still doesnt make sense
✓ ANSWER ACCEPTED
can someone explain the return statement to me?
1 answer
✓ Accepted answer
Address
You can think of this return statement the same way in real life. Say for example, a company sends you a package that you don't want. Them sending you that package is the initial function call, and you returning it to them is what they get back from you. This exact same logic applies in programming as well. Here's an example:
-- A function called "GetSomeValue"
local function GetSomeValue()
-- Returns a string "Some value" to where ever it was called.
return "Some value"
end
local Value = GetSomeValue() -- Oh hey, it's called right here. So this is where the returned value will end up!
print(Value) -- > "Some value"
I'd go into more detail, but I already have a video explaining this topic on my channel that you can check out here. Hope this helped, let me know if you have any questions!
1 comment
0
thanks so much!! your vid helped me a TON
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
https://scriptinghelpers.org/glossary/return