When programming in Fortran (say F95), start with the most basic program, our friend “Hello World!”.
program helloWorld print *, "Hello World!" end program helloWorld
A three line program (hello.f95). No need to worry about I/O libraries, or any sort of formatting. It is simple. This is compiled using gfortran as:
The print statement could have also been replaced with the more traditional:
write (*,*), "Hello World!"
If this were an older Fortran program (pre-F90) the code would look similar, but wouldn’t allow any free-formatting, for example (hello.for):
1234567 program helloWorld write (*,*), "Hello World!" end program helloWorld
Here the actual code begins in the 7th column, and columns 1-6 are reserved for other things like program labels. If a line of code creeps into those columns, there will be an error of some sort.