the highest as a unary operator or the lowest as a binary one. In vector3 = matrix * vector1 + vector2 vector3 =(matrix .times. vector1) + vector2 the two expressions are equivalent only if appropriate parentheses are added as shown. In each case there must be defined, in a module, procedures defining the operator and assignment, and corresponding operator-procedure association, as follows: INTERFACE OPERATOR(//) !Overloads the // operator as invoking string_concat procedure MODULE PROCEDURE string_concat END INTERFACE The string concatenation function is a more elaborated version of that shown already in Basics. Note that in order to handle the error condition that arises when the two strings together exceed the preset 80-character limit, it would be safer to use a subroutine to perform the concatenation (in this case operator-overloading would not be applicable.) MODULE string_type IMPLICIT NONE TYPE string80 INTEGER length CHARACTER(LEN=80) :: string_data END TYPE string80 INTERFACE ASSIGNMENT(=) MODULE PROCEDURE c_to_s_assign, s_to_c_assign END INTERFACE INTERFACE OPERATOR(//) MODULE PROCEDURE string_concat END INTERFACE CONTAINS SUBROUTINE c_to_s_assign(s, c) TYPE (string80), INTENT(OUT) :: s CHARACTER(LEN=*), INTENT(IN) :: c s%string_data = c s%length = LEN(c) END SUBROUTINE c_to_s_assign SUBROUTINE s_to_c_assign(c, s) TYPE (string80), INTENT(IN) :: s CHARACTER(LEN=*), INTENT(OUT) :: c c = s%string_data(1:s%length) END SUBROUTINE s_to_c_assign TYPE(string80) FUNCTION string_concat(s1, s2) TYPE(string80), INTENT(IN) :: s1, s2 TYPE(string80) :: s INTEGER :: n1, n2 CHARACTER(160) :: ctot n1 = LEN_TRIM(s1%string_data) n2 = LEN_TRIM(s2%string_data) IF (n1+n2 <= 80) then s%string_data = s1%string_data(1:n1)//s2%string_data(1:n2) ELSE ! This is an error condition which should be handled - for now just truncate ctot = s1%string_data(1:n1)//s2%string_data(1:n2) s%string_data = ctot(1:80) END IF s%length = LEN_TRIM(s%string_data) string_concat = s END FUNCTION string_concat END MODULE string_type PROGRAM main USE string_type TYPE(string80) :: s1, s2, s3 CALL c_to_s_assign(s1,'My name is') CALL c_to_s_assign(s2,' Linus Torvalds') s3 = s1//s2 WRITE(*,*) 'Result: ',s3%string_data WRITE(*,*) 'Length: ',s3%length END PROGRAM Defined operators such as these are required for the expressions that are allowed also in structure constructors (see Derived-data types): str1 = string(2, char1//char2) ! structure constructor Arrays In the case of arrays then, as long as they are of the same shape (conformable), operations and assignments are extended in an obvious way, on an element-by-element basis. For example, given declarations of REAL, DIMENSION(10, 20) :: a, b, c REAL, DIMENSION(5) :: v, w LOGICAL flag(10, 20) it can be written: a = b ! whole array assignment c = a/b ! whole array division and assignment c = 0. !