For i := begin (step) end do
statements
has the following form in FORTRAN:
do i = begin, end, step
statements
end do
begin, step and end must be of type integer.
sum = 0
do i = 1, 10
read *, number
sum = sum + number
end do
while condition do
statements
has the following form in FORTRAN:
do while ( Condition )
statements
end do
Example:
sum = 0
read *, number
do while ( number .ge. 0 )
sum = sum + number
read *, number
end do
if then else construction has one of the following forms in
FORTRAN:
if ( Condition ) then
statements
end if
or
if ( Condition 1 ) then
statements
else if ( Condition 2 ) then
statements
else
statements
end if
Examples:
if ( i .eq. 0 ) then
a = a+1
print *, a
end if
or
if ( i .eq. 0 ) then
read *, a
print *, a
else
read *, b
print *, b
end if
or
if ( i .eq. 1 ) then
a = a+1
print *, a
else if ( i .eq. 2 ) then
b = b+1
print *, b
else
c = c+1
print *, c
end if