For i := begin (step) end do statementshas the following form in FORTRAN:
do i = begin, end, step statements end dobegin, step and end must be of type integer.
sum = 0 do i = 1, 10 read *, number sum = sum + number end do
while condition do statementshas the following form in FORTRAN:
do while ( Condition ) statements end doExample:
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 ifor
if ( Condition 1 ) then statements else if ( Condition 2 ) then statements else statements end ifExamples:
if ( i .eq. 0 ) then a = a+1 print *, a end ifor
if ( i .eq. 0 ) then read *, a print *, a else read *, b print *, b end ifor
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