Home > Mobile >  How would I return to the start of a while statement instead of just straight breaking
How would I return to the start of a while statement instead of just straight breaking

Time:06-17

When I try to use a break statement to go back to the start of the infinite loop, it breaks right back to the first while loop asking for pie_type. Shown Here.

CodePudding user response:

That break (selected in the image) breaks the while True loop. If you want to continue from the beginning of this loop, you need to use continue instead of break. Is that what you wanted to do?

A hint for you: don't post images. Instead, post the code.

CodePudding user response:

break is useful to exit loop (as if in haste) due to some external condition being met.

continue is used to transfer control back to the beginning of loop

  • Related