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 />

key words) in statements. Two adjacent statement words must always be separated by at least one<br />

blank unless one of them is a special character. Thus:<br />

let X = Y<br />

can be written as:<br />

let X=Y<br />

but not:<br />

letX=Y,<br />

and:<br />

if (SIGN + 5) is greater than DELTA<br />

can be written as:<br />

if(SIGN+5) is greater than DELTA<br />

but not as:<br />

if(SIGN+5) isgreaterthanDELTA.<br />

Merely looking at a statement usually makes it clear whether a blank is needed or not. Because multiple<br />

blanks are treated as single blanks, blank characters can be freely used to improve the readability<br />

of statements, as many of the illustrations in this book demonstrate.<br />

Statements can be typed as desired in a program, with one slight restriction. A statement can be written<br />

on more than one input line, or several statements can be written on the same line, but statement<br />

words (names, numbers, and key words) cannot be split between lines. Consequently, names and<br />

constants are restricted to the length of one record. (Remember that the exponentiation symbol **<br />

is a single unit and cannot be split.) Statement labels, where used, must precede the statement but<br />

need not appear on the same line as the statement. More than one label may be prefixed to a single<br />

statement.<br />

The logical structure of a program should be reflected in the physical layout. The use of indenting<br />

to draw attention to a departure from sequential execution of statements is one example. The use<br />

of appropriate control structures, rather than ad hoc direction of control flow through go to, can<br />

contribute greatly to this goal.<br />

1.21 Clarifying Comments In a Program<br />

Whenever it appears that a clarifying remark would be helpful to the reader, a comment should be<br />

used. A comment is delimited on the left by two single apostrophes (''). Comments can appear<br />

anywhere in a program except within a word. They may appear on the same line as program statements<br />

or on separate lines. Comments serve only as documentation, but they should be used wher-<br />

30

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

Saved successfully!

Ooh no, something went wrong!