scana
scana

Reputation: 111

Is '(A)' a keyword?

I have a doubt about Fortran code. Is "A" a keyword? I found this character used in write and format commands but I can't find some specific documentation about it. Here are some examples:

CHARACTER *10  name
write(*,1) name
1 format   ("   Your name is ",A)

or

end = LNBLNK(string)
write(4,'(A)') string(1:end)

Upvotes: 1

Views: 80

Answers (1)

No, A is an data edit descriptor for character string output. For more read some textbook about Fortran I/O or a tutorial like https://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/format.html

And it the second code sample, A is not even in a position where a keyword would be used. '(A)' is a normal string, like 'Hello world' or " Your name is ", for example. But here the content of the string and where the string is used is what matters. It contains a descriptor and it is used as a format string in the write statement.

In the FORMAT statement it is not a normal string, but a special syntax, but it works the same.

Upvotes: 2

Related Questions