Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 39 ยท Getting Started

What Is Fortran?

Meet Fortran, the oldest high-level language still used for weather models, physics and supercomputers. Learn its history, standards, strengths and what you will build.

Fortran is a compiled, statically typed programming language designed for one job: turning mathematical formulas into fast programs. The name comes from "Formula Translation". It first ran in 1957 at IBM, making it the oldest high-level language still in everyday use, and it is still the language behind many weather forecasts, climate models, fluid simulations and supercomputer benchmarks.

If you have only heard jokes about punch cards, forget them. Modern Fortran (2003, 2008, 2018 and 2023) has modules, derived types, object-oriented features, pointers, coarrays for parallel programs and a free-form syntax. It is also friendly to beginners: arrays are built in, whole-array arithmetic needs no loops, and the compiler can generate very fast machine code because the language rules make aliasing and array shapes easy to reason about.

This course starts from zero. You will install a compiler, write programs, learn types, control flow and arrays, then move on to procedures, modules, files, parallel computing and complete projects.

Where Fortran is used

Fortran dominates areas where the same numerical kernel runs billions of times:

  • Weather and climate: large parts of operational forecasting and climate models are Fortran.
  • Physics and engineering: computational fluid dynamics, finite elements, quantum chemistry, astrophysics.
  • Linear algebra: the reference BLAS and LAPACK libraries, which NumPy, MATLAB and R rely on, were written in Fortran.
  • Supercomputing: Fortran with MPI and OpenMP is a standard on national-lab machines.

Why people still pick Fortran

Arrays built in Whole-array math, no loops.
Fast code Compilers optimize it well.
Huge libraries Decades of tested numerics.
Parallel ready Coarrays, MPI, OpenMP.
1 / 2

A short history

flowchart LR
  A["1957<br/>FORTRAN I"] --> B["1977<br/>Fortran 77"]
  B --> C["1990<br/>Fortran 90"]
  C --> D["2003<br/>Fortran 2003"]
  D --> E["2008<br/>coarrays"]
  E --> F["2018 / 2023<br/>modern standards"]

Each standard keeps old programs working while adding new features.

  • FORTRAN I (1957) was led by John Backus. Its goal was to prove that a compiler could produce code nearly as fast as hand-written assembly.
  • Fortran 77 brought structured if blocks and character strings. A huge amount of legacy code is written in it.
  • Fortran 90 was the big modernization: free-form source, modules, array syntax, dynamic memory (allocatable), derived types and kind parameters.
  • Fortran 95 added forall, pure and elemental procedures.
  • Fortran 2003 added object-oriented programming, C interoperability and iso_fortran_env.
  • Fortran 2008 added coarrays, do concurrent, submodules and block constructs.
  • Fortran 2018 and 2023 extend the parallel features and add many small conveniences.

Note the spelling: the language was written FORTRAN in capital letters until Fortran 90. Today it is simply Fortran, and modern source files use lowercase or mixed case, because Fortran is case-insensitive: Total, TOTAL and total are the same name.

What a Fortran program looks like

Here is a complete program that converts a temperature. Read it now and do not worry about the details; the next lessons explain every line.

FORTRAN
program convert
  implicit none
  real :: celsius, fahrenheit

  celsius = 36.6
  fahrenheit = celsius * 9.0 / 5.0 + 32.0
  print *, "Body temperature in F:", fahrenheit
end program convert

Things to notice: a program has a name and ends with end program; every variable is declared with a type; implicit none tells the compiler to complain about undeclared names; print * writes to the screen with default formatting; and the language has no semicolons or braces. A new line ends a statement.

How this course runs your code

The learning site can run code in Python, C, Java and many other languages directly in the page, but it does not have a Fortran compiler. In this course Fortran listings are therefore read-only, and you copy them into a real compiler (the next lesson shows how to install one, for free). Where the idea matters more than the exact digits, we show a small runnable Python stand-in that mimics the same logic, clearly labelled, so you can experiment with the numbers.

Python Stand-in (Python): the temperature program

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Python Stand-in (Python): try other temperatures

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Fortran compared with other languages

Fortran C Python
Typical use numerical simulation systems, everything scripting, glue, data
Arrays built in, with shapes pointers and manual sizes lists, or NumPy
Whole-array math yes no with NumPy
Speed on numeric loops excellent excellent slow without NumPy
Learning curve gentle steeper gentle

Fortran is not a general-purpose language for websites or apps, and that is fine. For numerical work it is hard to beat, and it combines well with others: Python can call Fortran through f2py, and C can call it through iso_c_binding (a later chapter).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does the name Fortran come from?

    FORTRAN stands for Formula Translation, because it was created to translate mathematical formulas into machine code.
  2. 2. Which statement about Fortran case sensitivity is true?

    Fortran is case-insensitive, so Total, TOTAL and total all refer to the same variable.
  3. 3. Which Fortran standard introduced modules and array syntax?

    Fortran 90 was the big modernization: free-form source, modules, array syntax, allocatable arrays and derived types.
  4. 4. Why are the Fortran listings in this course read-only?

    The page can run Python and C but not Fortran, so listings are shown for you to compile locally, with Python stand-ins where useful.

Summary

  • Fortran (Formula Translation) dates from 1957 and is still the workhorse of numerical computing.
  • Modern Fortran has modules, derived types, object orientation, coarrays and free-form source.
  • The language is case-insensitive and statements end at the end of a line.
  • It is strongest for arrays, simulation and high-performance computing.
  • In this course Fortran listings are read-only and Python stand-ins are labelled.

Next: Installing a Fortran Compiler