27.1: Fortran 95/2003/2008 Keywords
- Page ID
- 54813
\( \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}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)In programming, a keyword is a word or identifier that has a special Fortran 95/2003/2008 meaning. Keywords are reserved in that they cannot be used for anything else such variable names.
The Type as listed in the table refers to the following:
- statement \(\rightarrow\) implies a keyword that starts a statement, usually one line unless there is a continuation "&"
- construct \(\rightarrow\) implies multiple lines, usually ending with "end ..."
- attribute \(\rightarrow\) implies it is used in a statement to further clarify or specify additional information.
For reference, below is a partial list of keywords or reserved words. For a complete list of keywords, refer to the on-line GNU Fortran 95/2003/2008 documentation.
Keyword | Type | Meaning |
---|---|---|
allocatable | attribute | no space allocated here later allocate |
allocate | statement | allocate memory space now for variable |
assignment | attribute | means subroutine is assignment (=) |
backspace | statement | back up one record |
call | statement | call a subroutine |
case | statement | used in select case structure |
character | statement | intrinsic data type |
close | statement | close a file |
complex | statement | intrinsic data type |
contains | statement | internal subroutines and functions follow |
cycle | statement | continue the next iteration of a do loop (skipping the subsequent statements) |
deallocate | statement | free up storage used by specified variable |
default | statement | in a select case structure - all others |
do | construct | start a do loop |
else | construct | part of if, else if, else, end if |
else if | construct | part of if, else if, else, end if |
elsewhere | construct | part of where, elsewhere, end where |
end do | construct | ends do loop |
end function | construct | ends function |
end if | construct | ends if |
end interface | construct | ends interface |
end module | construct | ends module |
end program | construct | ends program |
end select | construct | ends select case |
end subroutine | construct | ends subroutine |
end type | construct | ends type |
end where | construct | ends where |
endfile | statement | mark the end of a file |
exit | statement | continue execution outside of a do loop |
format | statement | defines a format |
function | statement | starts the definition of a function |
if | statement and construct | if(...) statement |
implicit | statement | "none" is preferred to help find errors |
in | a keyword for intent | the argument is read only |
inout | a keyword for intent | the argument is read/write |
integer | statement | intrinsic data type |
intent | attribute | intent(in) or intent(out) or intent(inout) |
interface | construct | begins an interface definition |
intrinsic | statement | says that following names are intrinsic |
inquire | statement | get the status of a unit |
kind | attribute | sets the kind of the following variables |
len | attribute | sets the length of a character string |
logical | statement | intrinsic data type |
module | construct | beginning of a module definition |
namelist | statement | defines a namelist of input/output |
nullify | statement | nullify a pointer |
only | attribute | restrict what comes from a module |
open | statement | open or create a file |
operator | attribute | indicates function is an operator like + |
optional | attribute | a parameter or argument is optional |
out | a keyword for intent | the argument will be written |
statement | performs output to screen | |
pointer | attribute | defined the variable as a pointer alias |
private | statement and attribute | in a module |
program | construct | start of a main program |
public | statement and attribute | in a module - visible outside |
read | statement | performs input |
real | statement | intrinsic data type |
recursive | attribute | allows functions and derived type recursion |
result | attribute | allows naming of function result |
return | statement | returns from exits subroutine or function |
rewind | statement | move read or write position to beginning |
select case | construct | start of a case construct |
stop | statement | terminate execution of the main procedure |
subroutine | construct | start of a subroutine definition |
target | attribute | allows a variable to take a pointer alias |
then | construct | part of if construct |
type | construct | start of user defined type |
use | statement | brings in a module |
where | construct | conditional assignment |
while | construct | a while form of a do loop |
write | statement | performs output |