Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ 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.