In this guide, we will discuss Continue Statement in Dart Programming Language. The continue statement skips the subsequent statements in the current iteration and takes the control back to the beginning of the loop. Unlike the break statement, the continue statement doesn’t exit the loop. It terminates the current iteration and starts the subsequent iteration.
The following example shows how you can use the continue statement in Dart −
Example
void main() { var num = 0; var count = 0; for(num = 0;num<=20;num++) { if (num % 2==0) { continue; } count++; } print(" The count of odd values between 0 and 20 is: ${count}"); }
The above example displays the number of even values between 0 and 20. The loop exits the current iteration if the number is even. This is achieved using the continue statement.
The following output is displayed on successful execution of the above code.
The count of odd values between 0 and 20 is: 10
Next topic : Click Here
Pingback: Break Statement in Dart Programming | Adglob Infosystem Pvt Ltd
Pingback: Dart Programming - Loops | Adglob Infosystem Pvt Ltd