I am stuck on how to make a for i=
loop go down in numbers.
I know how to make it go up but not down.
Any help for if it is possible is greatly appreciated!
2 Likes
In a For Loop the numbers can be positive or negative (See picture)
You can make the 3rd Value Negative than instead of adding something like +1 it adds -1 which is counting down
7 Likes
for i = loops can actually take a third argument, detailing the increment! An example of what you want could be
for i = 5,0,-1 do
print(i) --5,4,3,2,1,0
end
1 Like
for i = 10, -10, -1 do --[[ do somethinf--]] end
1 Like
Thank you everyone who helped!
Wizard101 was first to reply with this method so I gave them the solution tag.
3 Likes