Restart the loop

C_Dedev -  
jee pee Posted messages 31892 Registration date   Status Moderator Last intervention   -
Hello,
I would like to know if there is a way to restart the script at the beginning of a loop
something that looks like this.
(the solution of simply adding a condition before the
 print("an other thing")
does not fit the situation of the real script)

 infinite = True while infinite == True: if str(input()) == "True": print("something") #restart the loop print("an other thing") 

1 answer

  1. jee pee Posted messages 31892 Registration date   Status Moderator Last intervention   9 984
     
    Hello,

    while True: if input("stop ? ") == "y": print("stop") break print("the next one") print("end")


    or

    while True: if input("restart ? ") == "y": print("next") continue print("the next one") print("end")


    0