Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What is an efficient for loops?

Is it this?

a=0
for i=0, 1, .1 do
	a=a+i
end

or this

for i=0, 1 do
	a = a + 1
end

1 answer

They both can work the same

if you do a = a + 1 then heres example how it would work

	for i=0, 10 do
	a = a + 1
	end
	-- what this does is it will add a + 1, 10 times

same thing as doing this which i would recommend to use instead (better practice, more efficient)

	for i=0, 10, 1 do
	a = i
	end
	-- what this does is it adds a by 1 to 10 like the last one the reason it has 1 at the end is how much it skips by to get to 10

if it was 2 then the output would be this

2, 4, 6, 8, 10

This discussion is preserved as it was. New answers, comments, and votes are closed.