Iteration again and again using loop

Viewed 34

I want to loop that iterates again and again, like when You go from 0 to 4. after it reaches 4 it again starts with 0. Is it possible?

while True:
   while I <10:
       if I <=5:
        for c in a:
         run.chat(i)
         i+=1
       else:
           continue

Is it true code?

1 Answers

Sure, just reset the variable if it reaches the boundary:

i = 0
while True:
    print(i)
    i += 1
    if (i > 4):
        i = 0
Related