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.

CONTINUE<br />

Syntax<br />

CONTINUE<br />

Description<br />

The <strong>UniBasic</strong> CONTINUE command transfers control to the next iteration of a<br />

FOR/NEXT or LOOP/REPEAT statement.<br />

Tip: Use CONTINUE instead of GOTO in structured programs.<br />

Generally, the statements within a FOR/NEXT or LOOP/REPEAT structure execute<br />

one by one. If you want to break the sequence to begin the next iteration without a<br />

CONTINUE statement, you could use the GOTO statement. However, this makes the<br />

code more difficult to read and maintain. By using CONTINUE, you can clearly<br />

express the program logic without degrading program structure.<br />

Example<br />

In the following example, the program segment prints the value of I until I reaches<br />

eight. When I is equal to eight, the CONTINUE statement drops out of the<br />

FOR/NEXT loop, and the next statement in the program executes.<br />

FOR I = 1 TO 10<br />

IF I > 8 THEN CONTINUE<br />

PRINT "I = ":I<br />

NEXT I<br />

The preceding code produces the following output:<br />

I = 1<br />

I = 2<br />

I = 3<br />

...<br />

I = 8<br />

CONTINUE 1-164

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

Saved successfully!

Ooh no, something went wrong!