I am trying to make a loop run 198 times. Every 20th time it counts, I want it to turn the bool value of 'on' to 'true'. After every 24th time it counts, I want 'on' to be 'false'. Does that make sense? I don't know how I would write this... Maybe with a for loop. Can someone help me out?
COMMUNITY QUESTION
Can someone help me with a loop problem?
1 answer
I think this is what you want. btw this is not a request site and I am doing this out of the kindness of my heart.
local bool = nil
for i = 1,198 do
if i%20 == 0 then
bool = true
elseif i%24 == 0 then
bool = false
end
end
Enjoy!
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
120 is divisible by both 20 and 24. Logical fallacy?