24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

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

8.6 Extended Assignment Statement<br />

<strong>Open</strong> <strong>Watcom</strong> <strong>FORTRAN</strong> <strong>77</strong> supports an extension to the <strong>FORTRAN</strong> <strong>77</strong> assignment statement, namely<br />

the extended assignment statement.<br />

v = v = v = ... = v = e<br />

1 2 3 n<br />

where:<br />

v’i<br />

must be one of the following:<br />

1. Variable names or array element names of type INTEGER, REAL, DOUBLE<br />

PRECISION, COMPLEX or double precision complex (COMPLEX*16).<br />

2. Variable names or array element names of type LOGICAL.<br />

3. Character variable names, character array elements, or character substrings.<br />

e<br />

must be one of the following and must follow the rules of the arithmetic, logical or character<br />

assignment statements:<br />

1. An arithmetic expression.<br />

2. A logical expression.<br />

3. A character expression.<br />

The extended assignment statement is equivalent to the following individual statements.<br />

v = e<br />

n<br />

v = v<br />

n-1 n<br />

.<br />

.<br />

.<br />

v = v<br />

2 3<br />

v = v<br />

1 2<br />

When using an extended assignment statement involving variables of mixed type, it is important to<br />

understand the exact way in which the assignments are performed. Assignment of each variable is made<br />

using the value of the variable to its immediate right, starting with the rightmost variable which is assigned<br />

the value of the expression. To help make this clear, consider the following program.<br />

190 Extended Assignment Statement

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

Saved successfully!

Ooh no, something went wrong!