Fortran 模块语法
示例
模块是类型声明,数据声明和过程的集合。基本语法为:
module module_name
use other_module_being_used
! The use of implicit none here will set it for the scope of the module.
! Therefore, it is not required (although considered good practice) to repeat
! it in the contained subprograms.
implicit none
! Parameters declaration
real, parameter, public :: pi = 3.14159
! The keyword private limits access to e parameter only for this module
real, parameter, private :: e = 2.71828
! Type declaration
type my_type
integer :: my_int_var
end type
! Variable declaration
integer :: my_integer_variable
! Subroutines and functions belong to the contains section
contains
subroutine my_subroutine
!module variables are accessible
print *, my_integer_variable
end subroutine
real function my_func(x)
real, intent(in) :: x
my_func = x * x
end function my_func
end module
热门推荐
10 生气蛋糕祝福语大全简短
11 生日祝福语陌生女生简短
12 生日奶茶红包祝福语简短
13 朋友出国旅游祝福语简短
14 微信立冬祝福语简短
15 生日祝福语宿舍舍友 简短
16 新年到来的祝福语简短
17 给孩子开学祝福语简短
18 夜雨祝福语简短10字