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> Basic Concepts<br />

if STATUS = BUSY<br />

add 1 to NO.IN.QUEUE<br />

else<br />

let STATUS = BUSY<br />

always<br />

Here, a STATUS variable is tested against a value denoting BUSY status. The variable NO.IN.QUEUE<br />

is incremented if the status flag is busy and the flow of control passes to always. Otherwise, the<br />

status flag is set to reflect the now BUSY status and control naturally passes to the always statement.<br />

logical<br />

expression<br />

False<br />

ELSE<br />

True<br />

first group<br />

of<br />

statements<br />

second group<br />

of statements<br />

ALWAYS<br />

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

The else statement and 'second group of statements' are optional. There are cases when the choice<br />

is simply whether or not to perform an action. This shortened form of the if statement is:<br />

if logical expression<br />

group of statements<br />

always<br />

13

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

Saved successfully!

Ooh no, something went wrong!