Getting started
Fortran is the language numerical code still reaches for, and these ten lessons put a compiler on the machine and a first program through it. They cover what the language is and which standard a compiler follows, the install pages, the edit-build-run loop with gfortran and gdb, the program units and source forms, and IMPLICIT NONE, which every later lesson assumes.
1.1
What Fortran is and where it runs
the language, the standards from FORTRAN 77 to Fortran 2023, where numerical code still uses it, gfortran and a first build
Open
1.2
Install gfortran on Linux, macOS and Windows
the packages per system, the install pages of the course, the version this course uses and a first compile
Open
1.3
An editor, gfortran and gdb
the edit-build-run loop, gfortran diagnostics while writing, gdb in batch mode and what this toolchain lacks
Open
1.4
Your first Fortran program
hello.f90 line by line, PROGRAM and END PROGRAM, PRINT *, the exit status and a missing END
Open
1.5
Warnings, errors and gfortran diagnostics
unused names, uninitialised values, -Wall -Wextra and the first error line read in full
Open
1.6
Program units: program, module, subroutine, function
the four units, what each one may hold, and the order gfortran compiles them in
Open
1.7
Free form and fixed form
columns 1 to 6, the C comment, the continuation column, -ffixed-form and why .f90 is free form
Open
1.8
IMPLICIT NONE and implicit typing
implicit typing by first letter, the typo it hides, IMPLICIT NONE in every unit and the error it gives
Open
1.9
Declarations, initialisation and SAVE
type declarations, ::, initialisation in the declaration, SAVE and the value that survives a call
Open
1.10
Style and modern practice
names, indentation, one idea per line, IMPLICIT NONE and INTENT as rules, and the features to prefer
Open