davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Tue Jul 05, 2011 6:58 am Post subject: |
|
|
This is old Fortran syntax, but still part of the Language. Look at the following.
The first use initialises the array x so all elements have the value 0.0
The second use initialises the array y so all elements have the value 'Settings'
The third case is equivalent to the second (for variable z), but uses newer syntax.
Code: |
! First
real :: x(5)
data x/5*0.0/
! Second
character(len=8) :: y(5)
data y/5*'Settings'/
! Third
character(len=8) :: z(5) = 'Settings'
|
The main thing to remember about DATA is it only initialises at compile time (sometimes at link time), so don't expect values to be reset when a procedure with DATA statements is called multiple times. _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|