While...Wend: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
No edit summary
Brendon (talk | contribs)
No edit summary
Line 1: Line 1:
While ''condition'' <br />
While ''condition'' <br />
:::[''statements''] <br />
:::[''statements''] <br />
WEnd
Wend


== Description ==
== 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.
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 ==
== Example ==


<pre>
<pre>
Rem While...WEnd Example
Rem While...Wend Example
'While...WEnd repeats a group of statements
'While...Wend repeats a group of statements
Dim Counter
Dim Counter
Counter = 1
Counter = 1
Line 17: Line 17:
   Print "Counter = " & Counter
   Print "Counter = " & Counter
   Counter = Counter + 1
   Counter = Counter + 1
WEnd
Wend
</pre>
</pre>



Revision as of 04:24, 17 August 2012

While condition

[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

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

Output

Counter = 1
Counter = 2
Counter = 3
Counter = 4

Related Items

DO...LOOP, FOR...NEXT, FOR EACH...NEXT