11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

LOOP/REPEAT<br />

Syntax<br />

LOOP<br />

[statements]<br />

[UNTIL expr [DO]<br />

statements]<br />

[WHILE expr [DO]<br />

statements]<br />

REPEAT<br />

LOOP {WHILE | UNTIL} expr DO<br />

statements<br />

REPEAT<br />

LOOP<br />

statements<br />

{WHILE | UNTIL} expr DO REPEAT<br />

Description<br />

The <strong>UniBasic</strong> LOOP/REPEAT command repeats any contained statements while or<br />

until a specified condition is met, depending on whether you use the WHILE or<br />

UNTIL clause. statements can precede and/or follow the test condition. If space<br />

permits, you can write the structure on one line. Otherwise, you can extend the<br />

structure on as many lines as necessary. REPEAT is required and finishes the LOOP<br />

operation.<br />

UniData executes the first set of statements on the first entry into the loop, and then<br />

evaluates the WHILE or UNTIL clause. If expr is true (using the WHILE keyword)<br />

or false (using the UNTIL keyword), UniData executes the second set of statements.<br />

If you have statements after a WHILE or UNTIL clause, the DO clause is required.<br />

Otherwise, it is optional. When the program execution reaches REPEAT, it returns to<br />

the first set of statements.<br />

1-428 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!