WHILE - WEND Statements

<< Click to Display Table of Contents >>

Home  mIoTa BASIC > mIoTa BASIC Language Reference > Statements > Iteration Statements (Loops) >

WHILE - WEND Statements

The syntax of the WHILE - WEND statements is ..

 

while expression;

..statements_list..

wend;

 

statements_list is a list of statements that is executed repeatedly as long as expression evaluates to TRUE.

 

The expression evaluation takes place before the statements_list is executed, so if expression evaluates FALSE on the first pass, the loop does not execute.

 

Here is an example of the WHILE - WEND loop statements ..

 

s = 0;

i = 0;

n = 10;

while i < n;     // loop until i reaches 10

  s = s + a[i];  // so i will count up from 0 to 9

  i = i + 1;

wend;