I have a character array names(10)*6. I'm looping through I = 1:10 and writing the values of names(I).
The problem is that names periodically is missing values, and if thats the case for a particular names(I), I want to skip it.
I was trying to do something like this.
IF(names(I) .NE. 0) THEN
WRITE(4,202) names(I)
ENDIF
I got an error telling me I'm dumb for comparing characters to 0. That makes sense. What should I compare it to? Empty spaces like this? How do I check if its not defined or empty after I declared space for it?
IF(mychar(I) .NE. ' ') THEN
WRITE(4,202) names(I)
ENDIF
The goal is to only issue the write command if there is actually something there. :-)
Edit Note: I may not initialize this array. I am wondering what the default value for an undefined declared index is, or if there is a function to check if a character array index is empty.
LEN_TRIM(string).eq.0,string.eq.'', andstring.eq.' 'are all equivalent. ( And all will likely be false if the string was never initialised. )