Fortran What are Implicit Variables in FORTRAN and How Do They Affect Programming?

Click For Summary
The discussion revolves around deciphering FORTRAN code for a particle detector project, specifically focusing on the challenges posed by implicit variable declarations. The user is struggling with understanding the code due to the author's use of implicit declarations, particularly for variables starting with letters "I" through "N" being treated as integers, while those starting with "A-H" or "O-Z" are treated as real numbers. There is mention of the IMPLICIT statement, which can override these defaults, but the user finds the overall concept less complicated than initially feared. The conversation highlights the difficulties of interpreting code written for personal use, emphasizing the need for clarity in variable declarations.
Poop-Loops
Messages
731
Reaction score
1
I got a new project from my professor to calculate the form factor of the cavity for his particle detector thing. He told me to get some code from a colleague, decipher it, and use it for the new cavity.

The code is in FORTRAN. I've had some programming experience, so it's not so bad, but this guy wrote the code for himself, so it's not easy to decipher. The main problem I am having is he is using a lot of implicit variable declarations. The only thing I've been able to find is that if it starts with "i" through "n" it's an integer. But I can't find a list anywhere online.

I was hoping one of you could point me in the right direction.
 
Technology news on Phys.org
Untyped variables are implicitly REAL for variables with names starting with characters "A-H" or "O-Z" and INTEGER for variables with names starting with characters "I - N".

This may, of course, be overriden by the use of the IMPLICIT statement.
 
That's it? Phew, thought it would be a lot more complicated.

Yeah, I'm getting a lot of "i"this and "i"that without any indication of what is going on. =/

Thanks for your help!
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 59 ·
2
Replies
59
Views
11K
  • · Replies 14 ·
Replies
14
Views
5K
  • · Replies 8 ·
Replies
8
Views
4K