Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What does "return" do?

It's a bit hard for me to understand what it does in the wiki, what does "return" do?

1 answer

Return is something that is primarily used in functions. When used in a function, the function gives you a the value next to a return, and the return send it to you, for example:

function bleh()
	return "lol"
end

print(bleh())

This would print 'lol'.

It can also be used to end something, like this:

if not true then
	return
end

1 comment

0

It can also be used to end a statement or loop in a nonstandard manner. *

This discussion is preserved as it was. New answers, comments, and votes are closed.