When a customer cancels an order, the program should skip the remaining steps and return to the main menu for the next customer. The continue statement does exactly that: it skips the rest of the current loop iteration and starts the next one. section 6.0
A canceled coffee order
Inside a while True loop, a confirmed order is saved. Otherwise, continue jumps back to the beginning of the loop, showing the next customer the menu without saving the canceled order. section 6.0
Listing 6.1 A main menu with simple functions
def main_menu():
while True:
order = get_order()
print("Check your order:")
print_order(order)
confirm = input("Confirm? Press Y to confirm, N to cancel: ")
if confirm == "Y" or confirm == "y":
save_order(order)
print("Thanks for your order:")
print_order(order)
else:
continue
def get_order():
return {}
def print_order(order):
print(order)
return
def save_order(order):
print("Saving order...")
return
main_menu()
Browse the complete main-menu example, including the confirmation condition and continue statement. section 6.0




