The Assignment Statement


The assignment statement has the following form:
variable = expression
Its purpose is saving the result of the expression to the right of the assignment operator to the variable on the left. Here are some rules:

Examples:

An Important Note:

A name declared with the PARAMETER attribute is an alias of a value and is not a variable. Therefore, it cannot be used on the left-hand side of =, although it can be used on the right-hand side. The following is wrong!
INTEGER, PARAMETER  :: InchToCM = 2.54, factor = 123.45
INTEGER             :: X = 15

InchToCM = factor * X