Within a subroutine I try to create a statement, however it will only work if I enter a number directly, as soon as I replace the number with a variable, it will give the er
You try to use a DIMENSION(1, 1) type as a REAL.
You shoul add (1, 1) to access to yout REAL contained in the DIMENSION(1, 1)
Use :
IF ( var%type3(1, 1) < 0.5 ) THEN
print *, 'IT WORKS'
END IF
Exemple to get this error :
MODULE vardef
TYPE vartype
REAL :: type3(1, 1)
END TYPE vartype
END MODULE vardef
PROGRAM test
USE vardef
TYPE(vartype) var
var%type3(1, 1) = 0
IF ( var%type3 < 0.5 ) THEN
print *, 'IT WORKS'
END IF
RETURN
END PROGRAM test