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

Table 2-3. System-Defined Constants<br />

______________________________________________________________________________<br />

Standard<br />

Name Symbol Value Units Mode<br />

pi.c p 3.141159265 -- Real *<br />

Exp.c e 2.718281828 -- Real *<br />

inf.c ∞ Largest value -- Integer<br />

computer can store<br />

Rinf.c ∞ Largest value -- Real *<br />

computer can store<br />

Radian.c - 57.29577 Degrees/radian Real *<br />

* On systems that support additional precision, these constants are of double mode.<br />

_______________________________________________________________________________<br />

2.5 Subscripted Variables<br />

Variables as described above may represent single, numeric data items in <strong>SIMSCRIPT</strong> <strong>II.5</strong>. A feature<br />

of many programming languages is the facility to represent and manipulate data in a way that<br />

reflects the natural structure of the data. Data occurring in the form of lists or tables, for example,<br />

have a regular structure. <strong>SIMSCRIPT</strong> <strong>II.5</strong> provides a structure by which a number of similar data<br />

items, the array elements, may be collectively referenced by a single name, while each individual<br />

element may be referenced by subscripting the array name with an index value.<br />

A simply ordered collection of data items, such as a list (figure 2-1), is represented by a one-dimensional<br />

array. The elements of this array can be referenced by an identifying name, LIST, for example,<br />

and an index number, called the array subscript, which can assume integer values from 1 up to<br />

the total number of elements in the list. The array name is used to identify the collection of elements.<br />

The subscript, enclosed in parentheses after the array name, is used to denote particular elements.<br />

Thus, the name of the variable that is the first element in the array LIST is LIST(1), the<br />

fifth element is called LIST(5), and the I th element is LIST(I). Figure 2-2 shows the list of figure<br />

2-1 with the individual element names inserted.<br />

Figure 2-1. A List Structure: One-dimensional Array<br />

43

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

Saved successfully!

Ooh no, something went wrong!