Code · 1 file

Sample Fortran File

Modern free-form Fortran, still central to scientific and high-performance computing. Every language sample implements the same small program so you can compare them side by side.

Fortran · 843 B

Sample Fortran file

An idiomatic Fortran example — the same customer program (or, for hardware languages, a small counter design) we offer in every language.

CC0 · free for any use · Verified by an independent tool · Report a problem

sample.f90 — first linesFortran
! Sample Fortran 2008 program — samplefiles.com
module customers_mod
  implicit none
  type :: customer
    integer :: id
    character(len=16) :: name
    real(8) :: balance
  end type customer
contains
  logical function is_vip(c)
    type(customer), intent(in) :: c
    is_vip = c%balance >= 10000.0d0
  end function is_vip
end module customers_mod

program sample
  use customers_mod
  implicit none
  type(customer) :: customers(3)
  integer :: i

  customers(1) = customer(1, 'Ada', 12500.0d0)
  customers(2) = customer(2, 'Grace', 830.5d0)
  customers(3) = customer(3, 'Linus', 10000.0d0)

File details

Size
843 B (843 bytes)
MIME type
text/x-fortran
SHA-256
91e7ad4c456eb68a78f8e3db65f1b6ccbe57dddaefaa610a498e4bd13d5f1bec
MD5
d43587fedd288c1c1edfc1699837f7bb

Download from the command line

curl -L -o sample.f90 https://files.samplefiles.com/code/f90/sample.f90

Or check the download in your browser with the checksum calculator.