advertisement
Jump Statement in Dart Programming
Jump statements are used to jump from one statement to another statement, or it can be said that they transfer the execution to another statement from the current statement.
Types of jump statement
- break
- continue
a. break Statement
break statement in Dart inside any loop gives one way to break or terminate the execution of the loop containing it and hence, transfer the execution to the next statement following the loop. It is always used as the if-else construct.
After that if the statement has been used, in which a condition is given that if the count is equal to 5, it will break the execution and till then, it will print inside the loop statement. Once it has reached 5, it will print out of while loop statement.
b. Continue Statement
While the break is used to end the flow of control, continue on the other hand is used to continue the flow of control. When a continue statement is encountered in a loop, it does not terminate the loop but rather jumps the flow to the next iteration.
After that, if the statement has to be used, in which a condition has been given that, if the count is equal to 5, it will skip the execution of the program. Next, the continue statement has been used. The continue statement will skip that line and execute the remaining code.
advertisement
Conversation
Your input fuels progress! Share your tips or experiences on prioritizing mental wellness at work. Let's inspire change together!
Join the discussion and share your insights now!
Comments 0