18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

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.

<strong>SIMSCRIPT</strong> <strong>II.5</strong> <strong>Programming</strong> <strong>Language</strong><br />

and is flowcharted in figure 1-2. When the logical expression is true, the group of statements is executed<br />

and flow of control continues through the always statement. When the logical expression<br />

is false, control transfers directly to the always. For example:<br />

If X less than A<br />

let A = X + Y<br />

let B = X - Y<br />

always<br />

logical<br />

expression<br />

True<br />

group<br />

of<br />

statements<br />

False<br />

ALWAYS<br />

Figure 1-2. Flow of Control After Shortened if Statement<br />

To improve program readability, the logical expression appearing in an if statement may be optionally<br />

followed by a comma. The word is may also be used before the "English" versions of the<br />

relational operators in logical expressions. Examples are:<br />

if STATUS is not equal to BUSY,<br />

if X is less than A,<br />

Also, because logical comparisons with the value zero occur frequently in programming, the words<br />

zero, positive, and negative may be combined with the words is and is not, replacing<br />

14

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

Saved successfully!

Ooh no, something went wrong!