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>Programming</strong> <strong>Language</strong> Concepts<br />

Specification phrases may appear in the list in any order, separated, as usual, by commas or and.<br />

The comma after the word normally is optional. The equals symbol (=) may replace the word is.<br />

As additional specification phrases are added in later sections, phrase choices will be increased but<br />

these rules will not change.<br />

Another possibility is to force explicit definition of all variables by use of the form:<br />

normally, mode is undefined<br />

This will produce a diagnostic for every undefined variable. This form is strongly recommended in<br />

order to guard against inadvertent background definition of misspelled variables.<br />

Individual variables that differ from the implied or normally defined mode can have their mode<br />

specified in a define statement. This statement lists one or more variable names and defines their<br />

common mode. The statement:<br />

define X, Y, Z as integer variables<br />

illustrates the way in which the define statement is used to declare that the variables X, Y, Z<br />

represent only integer values. If the background conditions were declared to be integer, a similar<br />

define statement using the word real might be used to define some variables as real.<br />

The define statement has a number of alternative forms. The only words that must appear are<br />

define, the variable names being defined, as, and the word variable or variables. The words<br />

a, an, integer, and real are included when needed. Some examples of the define statement<br />

are:<br />

define X as a real variable<br />

define X and Y as integer variables<br />

define X, Y, Z as variables<br />

define X as a variable<br />

The description of the define statement, like the normally statement, will be expanded in later<br />

paragraphs to include more than variable mode definition.<br />

Some computer systems provide an internal numeric representation of real numbers with an<br />

increased precision, usually achieved by doubling the size of the internal binary representation.<br />

<strong>SIMSCRIPT</strong> <strong>II.5</strong> allows variables to be declared with this representation, by the use of the variable<br />

mode double. On these systems, the normal background condition is double to allow the<br />

maximum precision for decimal values. The appropriate <strong>SIMSCRIPT</strong> <strong>II.5</strong> user's manual should be<br />

consulted to determine whether this variable mode is implemented. In general, on those systems<br />

that do not support this mode, double is interpreted as real.<br />

Throughout this book, the behavior ascribed to real variables may be assumed to extend to<br />

double variables. Examples of declarations are:<br />

define AMOUNT, INTEREST as double variables<br />

39

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

Saved successfully!

Ooh no, something went wrong!