When a while or for loop’s clause reaches a break statement it exits the loop. while True: print('Please type your name.') name = input() if name == 'your name': break print('Thank you!')