INCLAN: do: Difference between revisions

From CYANA Wiki
Jump to navigation Jump to search
m (1 revision)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
== Synopsis ==


Usage: do [''variable'' ''start'' ''end'' [''step'']] [parallel [continue]]
'''do'''
        .
:''sequence of statements''
        .
'''end do'''
      end do


The statement "do" executes a loop within a macro. Without parameters
or
the loop is executed unconditionally, i.e. until one of the statements
break, exit, quit or return is encountered. "do" followed by parameters
executes a FORTRAN-77 do-loop within a macro. The loop counter
variable and the integer expressions start, end, and step have the
usual meaning. Parallel loops are executed in parallel on nproc
processors (see variable nproc). If the keyword "continue" is
present, the program continues immediately with the execution of the
next statement after the parallel loop. Otherwise, the next statement
after the loop is executed when the parallel loop is finished.


'''do''' ''variable'' ''start'' ''end'' [''step''] [''parallel'' [''continue'']]
:''sequence of statements''
'''end do'''


Examples: do
== Description ==
            if (filename.eq.''' ''') break
            .
            .
          end do


          do i 1 10
Executes a loop within a macro. Without parameters the loop is executed unconditionally, i.e. until one of the statements [[INCLAN: break|'''break''']], [[INCLAN: exit|'''exit''']], [[INCLAN: quit|'''quit''']] or [[INCLAN: return|'''return''']] is encountered.
            print "Iteration $i."
 
          end do
'''do''' followed by parameters executes a FORTRAN-77 do-loop within a macro. The loop counter ''variable'' and the integer expressions ''start'', ''end'', and ''step'' have the usual meaning. '''Parallel''' loops are executed in parallel on [[INCLAN: nproc|'''nproc''']] processors. If the keyword '''continue''' is present, the program continues immediately with the execution of the next statement after the parallel loop. Otherwise, the next statement after the loop is executed when the parallel loop is finished.
 
== Examples ==
 
do
  if (filename.eq.' ') break
    .
    .
end do
 
do i 1 10
  print "Iteration $i."
end do
 
== See also ==
 
[[INCLAN: nproc|nproc]]

Latest revision as of 15:33, 13 August 2009

Synopsis

do

sequence of statements

end do

or

do variable start end [step] [parallel [continue]]

sequence of statements

end do

Description

Executes a loop within a macro. Without parameters the loop is executed unconditionally, i.e. until one of the statements break, exit, quit or return is encountered.

do followed by parameters executes a FORTRAN-77 do-loop within a macro. The loop counter variable and the integer expressions start, end, and step have the usual meaning. Parallel loops are executed in parallel on nproc processors. If the keyword continue is present, the program continues immediately with the execution of the next statement after the parallel loop. Otherwise, the next statement after the loop is executed when the parallel loop is finished.

Examples

do
  if (filename.eq.' ') break
    .
    .
end do
do i 1 10
  print "Iteration $i."
end do

See also

nproc