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:variable = expression
INTEGER :: Total, Amount, Unit Unit = 5 Amount = 100.99 Total = Unit * Amount
REAL, PARAMETER :: PI = 3.1415926 REAL :: Area INTEGER :: Radius Radius = 5 Area = (Radius ** 2) * PI
The meaning of the first assignment is computing the sum of the value in Counter and 1, and saves it back to Counter. Since Counter's current value is zero, Counter + 1 is 1+0 = 1 and hence 1 is saved into Counter. Therefore, the new value of Counter becomes 1 and its original value 0 disappears.
The second assignment statement computes the sum of Counter's current value and 3, and saves the result back to Counter. Thus, the new value of Counter is 1+3=4.
INTEGER :: Counter = 0 Counter = Counter + 1 Counter = Counter + 3
Initially, A and B are initialized to 3 and 5, respectively, while C is uninitialized. The first assignment statement puts A's value into C, making A=3, B=5 and C=3.
The second assignment statements puts B's value into A. This destroys A's original value 3. After this, A = 5, B = 5 and C = 3.
The third assignment statement puts C's value into B. This makes A=5, B=3 and C=3. Therefore, the values in A and B are exchanged.
The following is another possible solution; but, it uses one more variable.INTEGER :: A = 3, B = 5, C C = A A = B B = C
INTEGER :: A = 3, B = 5, C, D C = A D = B A = D B = C
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