Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Keywords

A keyword can either be a part of the syntax of a statement (statement keyword), or it can be the name of a dummy argument (argument keyword). Examples of statement keywords are WRITE, INTEGER, DO, and OPEN. Examples of argument keywords are arguments to the intrinsic functions.

In the intrinsic function UNPACK (vector, mask, field), for example, vector, mask, and field are argument keywords. They are dummy argument names, and any variable may be substituted in their place. Dummy argument names and real argument names are discussed in topic Program Units and Procedures.

Keywords are not reserved. The compiler recognizes keywords by their context. For example, a program can have an array named IF, read, or Goto, even though this is not good programming practice. The only exception is the keyword PARAMETER. If you plan to use variable names beginning with PARAMETER in an assignment statement, you need to use compiler option altparam.

Using keyword names for variables makes programs harder to read and understand. For readability, and to reduce the possibility of hard-to-find bugs, avoid using names that look like parts of Fortran statements. Rules that describe the context in which a keyword is recognized are discussed in topic Program Units and Procedures.

Argument keywords are a feature of Standard Fortran that let you specify dummy argument names when calling intrinsic procedures, or anywhere an explicit interface for the procedure is accessible. Argument keywords permit specifying actual arguments in an order, and may be required in an argument list containing an optional argument that is not passed in a procedure invocation.. Using argument keywords can make a program more readable and easy to follow. This is described more fully in topic Program Units and Procedures. The syntax statements in the A-Z Reference show the dummy keywords you can use for each Fortran procedure.