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
program helloopens the block; the matchingend program hellocloses it.implicit noneshould be everywhere — here the program has no variables to protect.print *, ...is list-directed output: the compiler picks the formatting.
Keywords and builtins used here
endimplicitnoneprintprogram
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.
Step 1 of 3 in Programs & variables, step 1 of 27 in Language basics.