While...Wend: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
m Ghenne moved page While...wend to While...Wend
JwellsNB (talk | contribs)
added javascript snippet
Line 7: Line 7:
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 (Basic) ==


<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
While Counter < 5
While Counter < 5
   Print "Counter = " & Counter
   document.write("Counter = " & Counter & "<br>")
   Counter = Counter + 1
   Counter = Counter + 1
Wend
Wend
</pre>
== Example (JavaScript) ==
<pre>
// While...Wend Example
/* While...Wend repeats a group of statements */
var Counter = 1;
while (Counter < 5) {
  document.write("Counter = " + Counter + "<br>");
  Counter++;
}
</pre>
</pre>



Revision as of 06:57, 12 May 2013

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 (Basic)

Rem While...Wend Example
'While...Wend repeats a group of statements

Dim Counter
Counter = 1
While Counter < 5
  document.write("Counter = " & Counter & "<br>")
  Counter = Counter + 1
Wend

Example (JavaScript)

// While...Wend Example
/* While...Wend repeats a group of statements */

var Counter = 1;
while (Counter < 5) {
  document.write("Counter = " + Counter + "<br>");
  Counter++;
}

Output

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

Related Items

Do...Loop, For...Next, For Each...Next