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

What does the keyword "return" means, and does?

What does the keyword "return" means/ and what it does?

1 answer

Return stops functions in a script.

e.g

function addNumbers(num1, num2)
    return num1 + num2
end
 
a = addNumbers(3, 5)
print(a)

If you have statements before end and after return, you'll receive errors.

So everytime you have a return, make sure to end it afterwards.

2 comments

0

Thanks, I need an example code with return in it if u can

0

I've edited the post and got one from the roblox wiki.

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