While...Wend loops | |||
|
The second type of loop to be covered here is the While...Wend and has a format like this:
The operation is that while the value of the expression is true, the inner code sequence is performed. More specifically, at the start of each loop the value of the expression is calculated and if it is true, the inner code sequence is performed and at the end of the loop the program simply goes back to the start of the loop (the expression comparison). If the value of the expression was false, the program continues from the line after the Wend. An example of using While...Wend loops is shown below: And that is pretty much all there is to while loops. As you can see in the third example, the loop is never entered because the value of the loop expression is calculated before the first time round the loop. Since it is false in that example, the loop is never processed. In the first example, the loop was able to continue because the command NextItem returns true when it is able to move onto the next item in the list (from the Arrays and lists topic. The same goes for the AddItem commands used at the top of the program.
| |||
|
Installation | Troubleshooting | Programming | Archives | Links Page last modified: 6th February 2002 |