While...Wend: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(Created page with "WHILE condition <br /> :::[statements] <br /> WEND '''Description''' WHILE...WEND repeats a group of statements while a given condition is TRUE. The required component, cond...")
 
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'''
 
<pre>
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
</pre>
 
'''Output'''
 
<pre>
Counter = 1
Counter = 2
Counter = 3
Counter = 4
</pre>
 
'''Related Items'''
 
[[do...loop|DO...LOOP]], [[for...next|FOR...NEXT]], [[for...each...nex|FOR...EACH...NEXT]]

Revision as of 21:20, 8 July 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