Title here
Summary here
Co-array Fortran provides several looping constructs. Here are some basic types of loops.
To run the program, save it as for_example.f90
and compile it using a Fortran compiler that supports Co-array features:
The output will be:
In Co-array Fortran:
do while
loop is used for condition-based looping.do
loop is used for counted iterations.range
, but we can use a regular do
loop to achieve similar functionality.do
without conditions.exit
is used to break out of a loop (equivalent to Go’s break
).cycle
is used to skip to the next iteration (equivalent to Go’s continue
).Note that Co-array Fortran, being an extension of Fortran, follows Fortran’s syntax and conventions. The structure of the program and the way loops are implemented differ significantly from Go, but the core concepts of iteration and flow control remain similar.