typestar

The program shape in Fortran

The smallest Fortran program: a named block and two list-directed prints.

! The smallest Fortran program: a named block and list-directed print.
program hello
    implicit none
    print *, "Gull Rock light: keeper on duty"
    print *, "Visitors welcome at low tide"
end program hello

How it works

  1. program hello opens the block; the matching end program hello closes it.
  2. implicit none should be everywhere — here the program has no variables to protect.
  3. print *, ... is list-directed output: the compiler picks the formatting.

Keywords and builtins used here

The run, in numbers

Lines
6
Characters to type
199
Tokens
16
Three-star pace
75 tpm

At the three-star pace of 75 tokens a minute, this run takes about 13 seconds.

Type this snippet

Step 1 of 3 in Programs & variables, step 1 of 27 in Language basics.

Next →

The program shape in other languages