Is it good for performance to return at the end of all functions (or bad if I dont), or does luau auto-cleanup the function once it has no code left to run?
The return function is mainly used if you want to break a function, or if you want to pass data back to where the function was called, like:
local function numberAdder(number)
return number += 1
end
print(numberAdder(5))
If you’re not trying to break a function or need to return a value back when the function is called, it’s fine not to use return
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.