REPEAT - UNTIL Statements

<< Click to Display Table of Contents >>

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

REPEAT - UNTIL Statements

The syntax of the REPEAT - UNTIL statements is ..

 

repeat

..statements_list..

until expression;

 

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

 

The expression is evaluated after each iteration at the UNTIL point, so the loop will execute statements_list at least once.

 

Here is an example of the REPEAT - UNTIL loop statements ..

 

s = 0;

i = 0;

n = 10;

repeat

  s = s + a[i];  // i will range from 0 to 9

  i = i + 1;

until i = n;     // loop until i reaches 10