Fortran (short for Formula Translation) is a high-level programming language that revolutionized scientific computing. Originally developed by IBM in the 1950s, it became the first widely used language for numeric and scientific computation.
While many programming languages have risen and faded, Fortran remains a core skill in high-performance computing (HPC)—a niche that powers some of the world’s most impactful and best-paid careers. Professionals fluent in modern Fortran often work in roles involving: -Climate modeling and weather prediction for space and defense agencies -Aerospace simulations used by NASA, Boeing, and SpaceX -Quantum chemistry and computational biology at cutting-edge research labs -Nuclear simulations and particle physics at CERN and national labs -Supercomputing clusters used at NVIDIA, Intel, and Top500 HPC centers -Mastering Fortran opens doors to elite research roles, internships, and industry offers—especially when combined with skills in CUDA, OpenMP, MPI, Julia, and C.
Modern Fortran (90, 95, 2003, 2008, 2018, 2023) supports structured programming, modules, recursion, array slicing, and even parallelization via OpenMP and MPI.
Learning Fortran puts you in a powerful club of people who understand low-level optimization, array math, and performance engineering.
Fixed-form Fortran was used in earlier versions like Fortran 66 and 77, where:
C or * in column 1Free-form Fortran, introduced with Fortran 90, removed these restrictions:
! anywhere on the line
Free-form Fortran removes the rigid column-based structure of older Fortran versions (like Fortran 77). It lets you write readable code, use indentation, and structure your program like modern languages (Python, C, etc.).| Feature | Fixed-Form (old) | Free-Form (modern) |
|---|---|---|
| File extension | .f, .for, .f77 |
.f90, .f95, .f03, .f08 |
| Column-sensitive | Yes | No |
| Indentation allowed? | No | Yes |
| End statements required? | Optional | Required |
Free-form is the modern and recommended way to write Fortran. It enables:
Use .f90, .f95, .f03, .f08, or .f18 for free-form Fortran.
Avoid .f, .for, .f77 unless you’re writing legacy, fixed-form code.
To run free-form Fortran code, you need a modern compiler.
Popular choices:
| Compiler | OS | Install Command |
|---|---|---|
gfortran |
Windows/Linux/Mac | sudo apt install gfortran or via MSYS2 |
ifort |
Intel’s Compiler | Part of Intel oneAPI (free tier) |
nvfortran |
NVIDIA HPC SDK | Good for GPU + CPU Fortran |
You can also use online compilers like:
!Syntax Basics
! This is a comment
PROGRAM hello
PRINT *, "Hello, Fortran!"
END PROGRAM hello
PROGRAM hello
PROGRAM marks the start of your program.hello is the name you give to your program. You can pick any valid name; it helps you (and the computer) keep things organized, especially when you have multiple programs.END PROGRAM hello (it’s a best practice, though not always enforced).PRINT *, outputs to the console, similar to print() in Python or printf in C.! starts a comment—everything after ! on a line is ignored by the compiler.You do not need to worry about columns or spacing.
PROGRAM and END PROGRAM define the main blockPRINT *, prints to console (like printf or print)! denotes a commentExample 1: Hello World
PROGRAM hello
PRINT *, "Hello, world!"
END PROGRAM hello
Run it online here:
https://www.tutorialspoint.com/compile_fortran_online.php
Expected Output:
Hello, world!
hello in PROGRAM hello is just a name for your program. You could call it main, test, or anything you like (no spaces, must start with a letter).Example 2: Comments and Whitespace
PROGRAM test_comments
! This is a comment
PRINT *, "Testing spacing"
PRINT *, " Spacing doesn't matter here!"
END PROGRAM test_comments
Output:
Testing spacing
Spacing doesn't matter here!
Questions
program, print)?