The break and continue statement
Let’s learn how to have more control over loops using the break and continue statements.
We'll cover the following...
The break
Statement
The break
is used for prematurely stopping a loop.
When Dart finds a break
statement, it breaks from the loop regardless of whether the iterations have been completed or not.
It’s mostly used with a conditional statement. Based on the condition, the loop will either need to exit or not.
Let’s look at an example similar to the one we looked at with for-loops, where we have a list of integers and we ...