Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
566 views
in Technique[技术] by (71.8m points)

Line continuation of strings in Fortran

I just started using gfortran 4.7.2 in Fedora 17. When I tried to use the following a test code, I am not getting output:

    PROGRAM test_ampersand
    IMPLICIT NONE
    PRINT *, 'I am a new learner of' &
     'fortran'
    END PROGRAM test_ampersand

I was expecting the output as:

I am a new learner of fortran
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This should work too:

PRINT *, 'I am a new learner of &
     &fortran'

That is, character literals can be continued across line breaks but each continuation line must have an ampersand in the first non-blank position.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...