44
We use the break command. It’s like an emergency exit. If you are looking for a specific name in a list of 1,000 students, once you find it, there’s no need to look at the rest.
You just say break, and Python jumps out of the loop immediately. It’s a great way to save the computer's energy.
Log in to add a comment.