Restart the loop

C_Dedev -  
jee pee Posted messages 31933 Registration date   Status Modérateur 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 réponse

jee pee Posted messages 31933 Registration date   Status Modérateur Last intervention   9 957
 
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