Developer Guide and Reference

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

Defined Assignment Statements

Defined assignment specifies an assignment operation. It is defined by a subroutine subprogram containing a generic interface block or a GENERIC statement that specifies ASSIGNMENT(=). The subroutine is specified in a SUBROUTINE or ENTRY statement that has two nonoptional dummy arguments.

Defined elemental assignment is indicated by specifying ELEMENTAL in the SUBROUTINE statement.

The dummy arguments represent the variable and expression, in that order. The rank (and shape, if either or both are arrays) and kind parameters of the variable and expression in the assignment statement must match those of the corresponding dummy arguments. The type types of the variable and expression must be type compatible with the corresponding dummy arguments

The dummy arguments must not both be numeric, or of type logical or character with the same kind parameter. This is because intrinsic assignment covers these cases and cannot be overridden.

If the variable in an elemental assignment is an array, the defined assignment is performed element-by-element, in any order, on corresponding elements of the variable and expression. If the expression is scalar, it is treated as if it were an array of the same shape as the variable with every element of the array equal to the scalar value of the expression.

See Also