In fortran you can define a default value for a variable on declaration which can be overwritten later in the code, also giving default values for all entries in an derived type array as follows:
PROGRAM test
TYPE data
INTEGER :: j=0
CHARACTER(len=10)::label="hello"
END TYPE data
TYPE(data) :: obj(2)
! overwrite the default of 0 in the first array entry
obj(1)%j=6 ! etc etc
END PROGRAM test
all very straightforward. But what is the syntax used for defining a default set of values for all array entries of derived datatypes? I looked up a few tutorials, but none of them addressed this. In other words, to have j=0 in the first element of obj%j by default and set it to 1 in the second and so on...
PROGRAM test
TYPE data
INTEGER :: j
CHARACTER(len=10)::label
END TYPE data
TYPE(data) :: obj(2)=??? ! what do I put to define an array of default types?
! for example these might be my desired default values
obj(1)%j=0
obj(1)%label="bad"
obj(2)%j=1
obj(2)%label="good"
END PROGRAM test