u/drizzlemox

▲ 9 r/lua

When using "return" in a function, should I use only "return" or "return nil"?

I was writing a simple script in lua and ran into this dilemma: whether to use return with nil or without the nil. Using nil seems more correct, but it’s more verbose. What return style should I use?

local function foo()
  return
end

local function bar()
  return nil
end
reddit.com
u/drizzlemox — 3 days ago