user22180
user22180

Reputation: 561

How to do block comment in fortran?

I have seen /* block comment */ for block commenting in C++. I know I can do line commenting by using ! or c, but is there any option for block commenting in Fortran?

Upvotes: 25

Views: 52024

Answers (7)

Coding Tech
Coding Tech

Reputation: 1

Do the following:

  • Go to the first line among all the multiple block lines to comment and place the typing position to the first column,
  • Press Alt+Shift in the keyboard,
  • Select all the lines to comment,
  • Unpress Alt+Shift from the keyboard
  • Type C/c It will work then . Check that out and tell me in the comments. Cheers!

Upvotes: -3

user12875544
user12875544

Reputation:

It is much simpler to use a text editor which allows for multiline commenting using "SHIFT + /"!

Upvotes: 3

user5732391
user5732391

Reputation:

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.

Upvotes: 5

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

Upvotes: -5

muraly
muraly

Reputation: 141

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

Upvotes: 12

Kbzon
Kbzon

Reputation: 347

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. :)

Upvotes: 20

High Performance Mark
High Performance Mark

Reputation: 78316

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.

Upvotes: 20

Related Questions