Fortran

Guide To Learn

New Fortran elements, at a glance

  • allocatable attribute to declare a dynamic array whose size is unknown at compile time
  • Bracket syntax for array constructors; for example, [1, 2, 3]
  • Implied do loop array constructor; for example, [(i, i = 1, 3)]
  • Type coercion, or mixed mode arithmetic, where the values of lower kinds get implicitly promoted when used in expressions with higher kinds
  • allocate and deallocate statements to explicitly allocate or free arrays from memory
  • Indexing and slicing arrays
  • Built-in functions:
    • sum, which returns the sum of all elements of a numeric array
    • lbound and ubound to return the lower and upper bounds, respectively, of an array
    • pack, which returns array elements that meet a condition
    • min and max to return the minimum or maximum, respectively, from any number of values
    • nint, which returns the nearest integer of an input real number
    • all, which returns .true. if all elements of an input logical array are .true.
New Fortran elements, at a glance

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top