i need this continue to skip the entire while loop but it skips just the if loop (i think)

Viewed 17
while continue_bool:

     try:
            name = input("Name (str): ")
            if (name in used_names):
                print("This name is already in use")
                continue
            quantity = int(input("quantity (int): "))

here is the code. i tested the continue statement and it does what i want it to do in a simple for loop. it seems here the if (x in y) creates a loop of its own that the continue just restarts. how do i make the continue restart the while loop?

1 Answers

Try taking the continue keyword outside the if block

Related