SUBROUTINE swap(i, j)
INTEGER :: i, j
IF (i < j)
! The BLOCK statement has no BLOCK_construct_name. The corrsponding END BLOCK
! statement cannot have a BLOCK_construct_name either.
BLOCK
INTEGER :: temp
temp = i
i = j
j = temp
END BLOCK
END IF
END SUBROUTINE swap
program a
INTEGER :: i = 5, j = 7 ,temp = 33
write(*,*) temp,i,j
BLOCK
INTEGER :: temp
temp = i
i = j
j = temp
write(*,*) temp , i , j
END BLOCK
write(*,*) temp , i , j
end program a
pasuka 发表于 2016-11-21 09:16
如果涉及openmp并行计算的话,block语句算是填补Fortran的空白,因为c和c++都允许在代码中间插入变量申明, ...
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |