Skip to main content

6.2) Understanding Arrays


We will begin with arrays. If you have done arrays in math then that is what we are referring to here. Say you have three people and you want to enter their height in the computer and then have it store (i.e. output) the values in a data file. One way to do it would be to declare real variables by referring to people as ‘a’, ‘b’, and ‘c’.

real :: persona
real :: personb
real :: personc

Then you could read in the values from the keyboard with:

read *, persona
read *, personb
read *, personc