12.07.2015 Views

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

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

DO (non-block)DO label [,] index = e1, e2 [, e3]labelindexlabels the last executable statement in the loop (this must not be atransfer of control).is the name of a variable called the DO variable.e1 is an expression which yields an initial value for i.e2 is an expression which yields a final value for i.e3is an optional expression yielding a value specifying the incrementvalue for i. The default for e3 is 1.DescriptionThe DO loop consists of all the executable statements after the specifying DO statement up to andincluding the labeled statement, called the terminal statement. The label is optional. If omitted, theterminal statement of the loop is an END DO statement.Before execution of a DO loop, an iteration count is initialized for the loop. This value is thenumber of times the DO loop is executed, and is:INT((e2-e1+e3)/e3)If the value obtained is negative or zero the loop is not executed.The DO loop is executed first with i taking the value e1, then the value (e1+e3), then the value(e1+e3+e3), etc.It is possible to jump out of a DO loop and jump back in, as long as the do index variable has notbeen adjusted. In a nested DO loop, it is legal to transfer control from an inner loop to an outerloop. It is illegal, however, to transfer into a nested loop from outside the loop.Syntax Extension§Nested DO loops may share the same labeled terminal statement if required. They may not sharean END DO statement.ExamplesDO 100 J = -10,10DO 100 I = -5,5100 SUM = SUM + ARRAY (I,J)76 Chapter 3

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

Saved successfully!

Ooh no, something went wrong!