11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

IF/THEN/ELSE<br />

Syntax<br />

IF expr THEN statements [ELSE statements]<br />

IF expr THEN<br />

statements...<br />

END [ELSE<br />

statements...<br />

END]<br />

IF expr ELSE statements<br />

IF expr ELSE<br />

statements<br />

END<br />

Description<br />

The <strong>UniBasic</strong> IF/THEN/ELSE command executes one of two blocks of statements<br />

based on a conditional expression. If expr is true, UniData executes the first group of<br />

statements. If expr is false, UniData executes the second group of statements.<br />

Points to Remember when Writing IF/THEN/ELSE<br />

Statements<br />

The ELSE clause is optional.<br />

An IF/THEN/ELSE structure can occupy either a single line or several lines. When<br />

coding single- line and multiline statements:<br />

The single-line form does not require an END before the ELSE.<br />

In the multiline form, each clause must contain at least one statement. If you<br />

do not want to take any action, use the NULL command. THEN and ELSE<br />

clauses must be delimited by END.<br />

IF/THEN/ELSE 1-368

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

Saved successfully!

Ooh no, something went wrong!