In Lua.
A classic.
while true do
-- body
endA different take on it.
repeat
-- body
until falseRemember tail call optimizations.
local function loop()
-- body
return loop()
end
loop()You don't even need the local variable given the powerful debug library:
(function() --[[body]] return debug.getinfo(1).func() end)()Alternatively (who needs spaces?):
while-1do
-- body
endBack to the future!
::loop::
-- body
goto loopA short infinite for iterator.
for _ in (function return true end) do
-- body
endThanks to ywang for some golfing.
Numeric for plus some double magic.
for _ = -1e308, 1e308, 1e-308 do
-- body
endShorter variant by ywang:
for _ = math.huge, math.huge do
-- body
endInstead of using math.huge, you can also divide something nonzero by zero.