31.12.2013 Views

TOPS-20 PASCAL Language Manual - Bitsavers

TOPS-20 PASCAL Language Manual - Bitsavers

TOPS-20 PASCAL Language Manual - Bitsavers

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

P~SCAL<br />

DATA TYPES<br />

When referring to the components of Two D, the first component in the<br />

first row is Two Dro,'.a.'l. The second component in this row is<br />

Two D ro,' B' 1. The Ii rst component in the second row is Two D rl,' A'] •<br />

The- last component in the last row is Two Dr4,'D']. In general,<br />

element j of row i is Two_Dri,jl. -<br />

You can define arrays of three or more dimensions in a similar<br />

fashion, for example:<br />

V A F< C h (.;.~ s s :3 II : . f.l f< F< A Y [1..;3 ~ :I... n, n r::. • 1\ F< ::I 0 F C h (.:.~ ~:; ~:; 1'1'1 e 1"1 ;<br />

This declaration specifies a three-dimensional chess game. The<br />

indices of the array are the levels, the ranks, and the files of the<br />

chessboard. For example, the reference Chess3D fI, 1, QR] specifies<br />

the first level, first square in the upper left corner (bottom lev~l,<br />

first rank, Queen's Rook file). Figure 2-2 illustrates the three<br />

levels of this array.<br />

Chess3D(1,n,<br />

Chessmen)<br />

(bottom)<br />

Chess3D(2,n,<br />

Chessmen)<br />

(middle)<br />

Chess3D(3,n,<br />

Chessmen)<br />

( top)<br />

1 OR ON OS 0 K KS KN KR<br />

Cf-IESS3D{3.n. CHESSMEN/<br />

CHESS3D{2.n.CHESSMEN/<br />

CHESS3D{I.n.CHESSMENj<br />

lK 098 81<br />

Figure 2-2:<br />

Three-Dimensional Array Chess3D<br />

When storing values in an array, <strong>PASCAL</strong> increments the indices from<br />

right to left. Thus, <strong>PASCAL</strong> increments the rightmost index until the<br />

maximum value is reached, then moves to the left to the next index,<br />

and so on, until all indices have been incremented to the specified<br />

amoun t.<br />

2-10

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

Saved successfully!

Ooh no, something went wrong!