Answers for "In range loop"

Lua
0

In range loop

-- In range loops are really easy to make.
-- It does not require pairs() or ipairs(), those are table iterations.

-- A in range loop is exactly as is:
for variable in 10 do
	print(variable)
	variable = variable + 1
end

-- If the above block fails it's purpose, the bottom block is a replacement.
for variable = 0, 1, 1 do
	print(variable)
	variable = variable + 1
end
Posted by: Guest on July-14-2021

Browse Popular Code Answers by Language