Search code examples
arrayslistfortranfortran77fortran95

Fortran 95 data list on multiple lines


   integer M

   character (len = 20) dict(50)

   data dict/'gum','sin','for','cry','lug','bye','fly','ugly', 
 M           'each','from','work','talk','with','self',
 M           'pizza','thing','feign','fiend','elbow','fault',
 M           'dirty','budget','spirit','quaint','maiden',
 M           'escort','pickax','example','tension','quinine',
 M           'kidney','replica','sleeper','triangle',
 M           'kangaroo','mahogany','sergeant','sequence',
 M           'moustache','dangerous','scientist','different',
 M           'quiescent','magistrate','erroneously',
 M           'loudspeaker','phytotoxic','matrimonial',
 M           'parasympathomimetic','thigmotropism'/

I was given some code in Fortran 77 and I must convert it to 95. I know very basic stuff on the data keyword like

character (len = 5) arr (5)
data arr /'aaa','bbb','ccc','ddd','eee'/

I don't know how I would do the above on separate lines. I'm guessing it has something to do with the above above but I can't figure out what the M is used for in this case.


Solution

  • In Fortran 77, any character in column 6 denotes a continuation line. "M" in this case. In Fortran 95 you instead use an ampersand on the end of the line to be continued.