Skip to content
Hello, Fortran
step 1/5

Reading — step 1 of 5

Learn

~1 min readBasics

FORTRAN (FORmula TRANslation) was the first high-level language, designed in 1957 by John Backus at IBM. Modern Fortran (Fortran 90 and newer) keeps the strengths — vectorized math, performance — and shed the column-numbered punch-card era.

program hello
    print *, "Hello, Fortran!"
end program hello
  • program name ... end program name defines the entry point
  • print *, ... — the * is a default format specifier (free-form output)
  • Comments use ! (anywhere on the line)
  • Statements end with newlines, not semicolons. Continuation uses &
  • Identifiers are case-insensitive (Print = PRINT = print)

Reading stdin: read *, var reads one or more values, type-aware:

integer :: n
read *, n
print *, n * 2

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…