How to do block comment in fortran?

北慕城南 提交于 2019-11-30 17:22:49

No, the strange concept of block comments is alien to Fortran. Your editor or development environment might provide a way to comment a block of lines in one go.

You can do a little hack though:

go to 100
 ! CHUNK OF CODE YOU WANT TO COMMENT OUT
100 continue

Yeah, I know it's horrible but it works. :)

muraly

If your FORTRAN compiler supports preprocessor macros then a popular method is to use (What exactly does an #if 0 ..... #endif block do?)

#if 0
...
Your comments ...
go here ...
...
#endif

A line with a c, C, *, d, D, or! in column one is a comment line; except that if the -xld option is set, then the lines starting with D or d are compiled as debug lines. The d, D, and! are nonstandard.

If you put an exclamation mark (!) in any column of the statement field, except within character literals, then everything after the ! on that line is a comment.

In Sublime text editor it can be used Toggle Comment (Ctrl+7) or Toggle Block Comment.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!