Fortran中字符串的续行 [英] Line continuation of strings in Fortran

查看:657
本文介绍了Fortran中字符串的续行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始在Fedora 17中使用gfortran 4.7.2。当我尝试使用以下测试代码时,我没有得到输出:

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 am a new learner of fortran


推荐答案

这应该也是一样:

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.

这篇关于Fortran中字符串的续行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆