Topic: New User Difficulty with Comments in Programs

I am a a brand new user to the program and after some help from the You Tube video, was finally able to get a simple program to run.

My issue is that whenever I try to comment in my source code, I get an error message saying there is an unclassified error. I was using a "c" to comment. I also tried to get the editor "comment line" to work. Everything failed. If I take the comment line out, the programs run fine. I'm obviously missing a trick. Any ideas what I'm doing wrong? How are in program comments supposed to be inserted and recognized?

2 (edited by JohnWasilewski 2012-05-24 06:34:06)

Re: New User Difficulty with Comments in Programs

For comments, I always use

EITHER
  A capital 'C' in character-position 1,
  at the far left-end of the line

OR
  an exclamation mark as the first character
  of the comment, beginning anywhere
  in the line

Both of these work for me.
---
John

Re: New User Difficulty with Comments in Programs

Euan,

Simply Fortran defaults to free-format Fortran, which does not use "C" for comments.  Make sure your file is saved as either "file.f" or "file.for" so that Simply Fortran recognizes the file as fixed-format Fortran. If you're not using fixed-format Fortran, the "C" character in the first column cannot be used for comments.

Additionally, don't worry too much about the real-time syntax checking.  The checking is rather aggressive, and it often passes the code to the compiler mid-line.  You might want to disable syntax checking (in the Options menu) while getting started.

Let us know if you have better luck!

Jeff Armstrong
Approximatrix, LLC

Re: New User Difficulty with Comments in Programs

Thanks for the guidance. For some reason the "insert comment" editor command works occasionally and will insert an exclamation point in the first column. In some cases I have done it manually. I don't really understand why it sometimes does it using the built in menu editing and sometimes doesn't but it's helped me get past first base and run some programs- thanks!

Re: New User Difficulty with Comments in Programs

@Euan

In my "Simply Fortran" editor there is no such command as "insert comment". But there are two commands:

edit -> comment line (shortcut Ctrl-R)
edit -> uncomment line (shortcut Ctrl-T)

In your open project, mark the lines that you want to comment and use either the shortcut or the "real command" for "comment line". This should put an exclamation mark in front of each selected line. This is an extremely handy feature that I find missing on the linux-editors I was using so far. To undo you can simply use the "uncomment line" command after you marked the lines. This is how it should work. If it doesn't there might be a problem with your installation.