Skip to main content
Engineering LibreTexts

4: Fortran 95/2003/2008 – Basic Elements

  • Page ID
    54204
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Before beginning to writing programs, it is necessary to know some of the basic elements of the Fortran language. This section describes some of the basic elements of Fortran. Additional information will be added in later sections.

    • 4.1: Variables
      The basic concept in a program is the concept of a variable. Variables in a program are like variables in an algebraic expression. They are used to hold values and then write mathematical expressions using them.
    • 4.2: Data Types
      Fortran, like many other high level programming languages, supports several different data types to make data manipulation easier. The most frequently used data types are integer and floating-point. Other data types are complex numbers, characters and logical data.
    • 4.3: Declarations
      Fortran variables must be declared before executable statements. This section provides an introduction to how variables are declared.
    • 4.4: Comments
      As previously noted, comments are information for the programmer and ignored by the compiler. The exclamation mark (!) denotes a comment.
    • 4.5: Continuation Lines
      A statement must start on a new line. If a statement is too long to fit on a line, it can be continued on the next line with an ampersand ('&').
    • 4.6: Declarations, Extended Size Variables
      The size or range of a number that can be held in a Fortran variable is limited. Special declarations can be used to provide variables with extended or larger ranges.
    • 4.7: Exercises


    This page titled 4: Fortran 95/2003/2008 – Basic Elements is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by Ed Jorgensen via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?