You've used the answer in your own question: Using the break statement.