![]() ![]() It will only run the code if the condition is initially TRUE, and will continue to run the code while the condition is TRUE, stopping as soon as the condition becomes FALSE - ie when intCounter > 20. The loop is testing to see if the condition is TRUE (less than or equal to 20). We then ask the loop to increase the value of the counter on each loop – and to run the loop until the counter is equal to or less than 20.Īs the counter is incremented on each loop, as soon as the counter reaches the value of 20, the code will stop. A working example of a For…Next Loop with an Exit Forįirst, we declare an integer ( intCounter) and give it a value of 1.Exiting (breaking) a loop before a condition is met.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |