It’s because searching is the most important things and… and let’s start solving our problem.
Finally the problem comes upon every beginner on programming.
If you have a loop, you can exit it at any moment by executing an Exit Do statement and continue...
Let suppose you have two nested loops or for…Next
Let suppose that you want to exit them from the innermost loop
In the following code you want to exit the both loop but this code don’t work as desired!
For I as integer = 1 To 10The solution is to use two different kinds of loops.
For J as integer = 1 To 10
If I = 0 then Exit
For
Next
Next
For I as integer = 1 To 10The following code will quit both of the loops! Nice, no?
Do while J <= 10
If I = 0 then exit for
J += 1
Loop
Next
Still get a problem? Post a comment.
No comments:
Post a Comment