1978 | OriginalPaper | Buchkapitel
Arrays and Iterations
verfasst von : Brian Meek
Erschienen in: Fortran, PL/I and the Algols
Verlag: Macmillan Education UK
Enthalten in: Professional Book Archive
Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.
Wählen Sie Textabschnitte aus um mit Künstlicher Intelligenz passenden Patente zu finden. powered by
Markieren Sie Textabschnitte, um KI-gestützt weitere passende Inhalte zu finden. powered by
Arrays are declared in PL/I using the declare statement as for simple variables. No special keyword is needed; the array and its dimensions and subscript ranges are declared by including a bound specification after the identifier. In the declaration <math display='block'> <mrow> <mi>D</mi><mi>E</mi><mi>C</mi><mi>L</mi><mi>A</mi><mi>R</mi><mi>E</mi><mtext> </mtext><mi>A</mi><mn>1</mn><mrow><mo>(</mo> <mrow> <mn>0</mn><mo>:</mo><mn>3</mn> </mrow> <mo>)</mo></mrow><mo>;</mo> </mrow> </math>]]</EquationSource><EquationSource Format="TEX"><![CDATA[$$DECLARE\;A1\left( {0:3} \right);$$ a one-dimensional array of four elements A1(0), A1(1), A1(2) and A1(3) is declared. Every array element has the same attributes of mode, base, scale and precision — in this case the default attributes. In the declaration\ <math display='block'> <mrow> <mi>D</mi><mi>E</mi><mi>C</mi><mi>L</mi><mi>A</mi><mi>R</mi><mi>E</mi><mtext> </mtext><mi>A</mi><mn>2</mn><mrow><mo>(</mo> <mrow> <mo>−</mo><mn>2</mn><mo>:</mo><mo>+</mo><mn>2</mn><mo>,</mo><mn>0</mn><mo>:</mo><mn>5</mn> </mrow> <mo>)</mo></mrow><mtext> </mtext><mi>F</mi><mi>I</mi><mi>X</mi><mi>E</mi><mi>D</mi><mtext> </mtext><mi>D</mi><mi>E</mi><mi>C</mi><mi>I</mi><mi>M</mi><mi>A</mi><mi>L</mi><mo>;</mo> </mrow> </math>]]</EquationSource><EquationSource Format="TEX"><![CDATA[$$DECLARE\;A2\left( { - 2: + 2,0:5} \right)\;FIXED\;DECIMAL;$$ a two-dimensional array of 5 * 6 = 30 elements is declared, each element being a fixed-point decimal number of default precision. When the lower bound of a subscript range is 1, as in <math display='block'> <mrow> <mi>D</mi><mi>E</mi><mi>C</mi><mi>L</mi><mi>A</mi><mi>R</mi><mi>E</mi><mtext> </mtext><mrow><mo>(</mo> <mrow> <mi>B</mi><mn>1</mn><mrow><mo>(</mo> <mrow> <mn>1</mn><mo>:</mo><mn>10</mn> </mrow> <mo>)</mo></mrow><mo>,</mo><mi>B</mi><mn>2</mn><mrow><mo>(</mo> <mrow> <mn>1</mn><mo>:</mo><mn>6</mn><mo>,</mo><mn>1</mn><mo>:</mo><mn>9</mn> </mrow> <mo>)</mo></mrow> </mrow> <mo>)</mo></mrow><mtext> </mtext><mi>F</mi><mi>L</mi><mi>O</mi><mi>A</mi><mi>T</mi><mrow><mo>(</mo> <mn>7</mn> <mo>)</mo></mrow><mo>;</mo> </mrow> </math>]]</EquationSource><EquationSource Format="TEX"><![CDATA[$$DECLARE\;\left( {B1\left( {1:10} \right),B2\left( {1:6,1:9} \right)} \right)\;FLOAT\left( 7 \right);$$ which is a factored declaration, the lower bound may be omitted, with its colon, it being taken as 1 by default <math display='block'> <mrow> <mi>D</mi><mi>E</mi><mi>C</mi><mi>L</mi><mi>A</mi><mi>R</mi><mi>E</mi><mtext> </mtext><mrow><mo>(</mo> <mrow> <mi>B</mi><mn>1</mn><mrow><mo>(</mo> <mrow> <mn>10</mn> </mrow> <mo>)</mo></mrow><mo>,</mo><mi>B</mi><mn>2</mn><mrow><mo>(</mo> <mrow> <mn>6</mn><mo>,</mo><mn>9</mn> </mrow> <mo>)</mo></mrow> </mrow> <mo>)</mo></mrow><mtext> </mtext><mi>F</mi><mi>L</mi><mi>O</mi><mi>A</mi><mi>T</mi><mrow><mo>(</mo> <mn>7</mn> <mo>)</mo></mrow><mo>;</mo> </mrow> </math>]]</EquationSource><EquationSource Format="TEX"><![CDATA[$$DECLARE\;\left( {B1\left( {10} \right),B2\left( {6,9} \right)} \right)\;FLOAT\left( 7 \right);$$