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.

Example<br />

In the following example, comments describe the subroutine’s functionality. The<br />

program uses !, *, and REM.<br />

1-674 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />

! Subroutine to test user input validity.<br />

SUBROUTINE TEST<br />

COMMON N,DATA.IN,VAL,SCORE(10)<br />

BEGIN CASE<br />

CASE DATA.IN=VAL<br />

** answer correct, then<br />

SCORE(N)=1 REM add one to SCORE(N)<br />

PRINT "Got it right!"<br />

! print message.<br />

CASE IN VAL<br />

SCORE(N)=0<br />

PRINT "Incorrect, try again."<br />

END CASE<br />

RETURN<br />

REM end of error check subroutine.

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

Saved successfully!

Ooh no, something went wrong!