Is there a way to make code cycle through a set of numbers?

I’m trying to make a graphing calculator and I want to have the code go through all whole numbers from something like -200->200. is there a way to do this?

Maybe something like this?

for i = -200,1,200 do
    print(i) -- prints from -200 to 200
end

I don’t think it works. It only prints this:
-200
0

Should be …

for i = -200, 200, 1 do
	print(i) -- prints from -200 to 200
end

I think he made a typo. It should be

for i = -200,200 do
    print(i) -- prints from -200 to 200
end
1 Like

You don’t need the 1, it is 1 by default :smiley:

My fault, I made a mistake… This text will be blurred

I know but wanted to show where that would go … that is the step input.

for i = -200, 200, 1 do
    print(i)
end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.