While...Wend: Difference between revisions
Jump to navigation
Jump to search
Line 29: | Line 29: | ||
var Counter = 1; | var Counter = 1; | ||
while (Counter < 5) { | while (Counter < 5) { | ||
NSB.Print("Counter = " + Counter); | |||
Counter++; | Counter++; | ||
} | } |
Revision as of 10:53, 12 May 2013
While condition
- [statements]
- [statements]
Wend
Description
While...Wend repeats a group of statements while a given condition is TRUE. The required component, condition, is any valid expression that evaluates to TRUE or FALSE. The optional component, statements, are executed during each iteration of the loop. While...Wend statements can be nested, and any Wend statements in a nested loop transfer execution to one level above the loop where the Wend occurs.
Example (Basic)
Rem While...Wend Example 'While...Wend repeats a group of statements Dim Counter Counter = 1 While Counter < 5 Print "Counter = " & Counter Counter = Counter + 1 Wend
Example (JavaScript)
// While...Wend Example /* While...Wend repeats a group of statements */ var Counter = 1; while (Counter < 5) { NSB.Print("Counter = " + Counter); Counter++; }
Output
Counter = 1 Counter = 2 Counter = 3 Counter = 4