Pass keyword in Python equivalent to Lua

I would like to know what’s the equivalent of Pass keyword or Ellipsis of Python in Lua.

If I understand correctly (I haven’t touched Python since college), the equivalent would be continue.

local numbers = {1, 2, 3, 4, 5}

for _, num in next, numbers do
	-- no more prematurely breaking or returning from a loop, we can just skip and carry on until finished
	if num ~= 2 then continue end
	print(num)
end

Pretty shoddy example, but I hope it brings the point across.

There is a ‘continue’ keyword in Python also for loops. Pass keyword is just a placeholder for a boilerplate code. Although it’s not that necessary in Lua but I would love if Lua has it because it looks neat for me. But I still appreciate your answer.

1 Like

Gotcha’! If I ever leave a bit of code out for later, or whichever my case is, I like to use the TODO keyword for comments as it contrasts with everything else (depending on your editor’s theme, I guess).

Maybe this could be of use to you. AFAIK, Lua has no equivalent to pass, unfortunately. I thought it was a bit more like the continue keyword, my apologies!

image

1 Like