! This file: ! http://ftp.aset.psu.edu/pub/ger/fortran/hdk/NameListDemo.f90 ! module any implicit none public character(len=4) :: ch integer :: i real :: r, s logical :: L namelist / aaa / ch,i,L,r,s end module any program nltest use any implicit none ! Set default values for Namelist variables. CH='' i=-1 L=.FALSE. r=+1 s=123.0 ! Input some Namelist variable values. read(*,nml=aaa) ! Type the following from the console screen: ! ! &AAA !!This is a comment ! CH='ABCD', ! This is another comment ! L=.TRUE., ! This is another comment ! R=4.0, I=3 !A final comment ! / ! Display the Namelist values (including the default value for s). write(*,nml=aaa) end program nltest