If you need to use the variable after the loop executes, define it outside the loop, so that it is local to the method.Ī While.Wend loop executes one or more lines of code between the While and the Wend statements. It goes out of scope after the condition of the loop is satisfied. When you define a local variable inside a loop structure, its scope is local to the structure itself, not the entire method. You can declare local variables inside a loop structure. For.Each: The loop runs repeatedly for each element in an array.A local counter variable controls the execution of the loop. For.Next: The loop runs a specified number of times given in the For statement.Do.Loop: The loop runs until the condition specified in the Do or Loop statements are satisfied.While.Wend: The loop runs until the condition specified in the While statement is satisfied.The following types of loop structures are available: Loops execute one or more lines of code over and over again. How do you solve this problem? The answer is a loop. But suppose you need it to count fifty times or perhaps until a certain condition is met? Simply repeating the code over and over in these cases will either be just tedious or not possible.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |