18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

is somewhat more descriptive. Note that the word input is optional. If input is not specified,<br />

this usage of the skip statement is distinguished by context from that used to skip output print lines.<br />

The word records implies input, while lines implies output.<br />

The skip record statement can be generalized to the form:<br />

skip E records<br />

in which case the current data record and the following E - 1 records are bypassed. If the expression<br />

(E) is zero, no records are skipped. If it is negative, the program terminates with an error message.<br />

The statement:<br />

skip 3 records<br />

skips the remainder of the current data record and also the next two data records. (See paragraph<br />

3.5.2 for program termination on end-of-file.)<br />

1.10 Logical Expressions<br />

Normally, computation proceeds from statement to statement in the order in which statements physically<br />

appear in a program listing. For example, in the four-statement example in paragraph 1, the<br />

program first executes the read statement, then the add statement, then the print statement, and<br />

halts when it reaches the stop statement. A fundamentally important extension of the concepts developed<br />

so far is the ability to specify, in a program, conditions under which alternative actions<br />

should be performed.<br />

Arithmetic expressions may be combined, using relational operators, to form logical expressions,<br />

which may be determined to be either true or false and then may be used to choose between alternative<br />

actions. A logical expression is formed by joining two arithmetic expressions with a binary<br />

relational operator. The relational operators are:<br />

= equal<br />

≠ not equal<br />

< less than<br />

≤ less than or equal<br />

> greater than<br />

≥ greater than or equal<br />

When a logical expression is encountered during the execution of a program, the current values of<br />

the variables or arithmetic expressions that make up the logical expression are used to determine its<br />

truth or falsity. Thus, if X = 1 and Y = 0, the logical expression:<br />

10

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

Saved successfully!

Ooh no, something went wrong!