Older versions of Fortran had strict guidelines on how a program was formatted. However new versions, especially Fortran 90 and above have modernized, allowing more flexibility.
Originally Fortran required all statements to be in ALL CAPS, and in fact the language itself was called FORTRAN (in caps). It remains a bit customary, though completely unnecessary, to put Fortran commands in ALL CAPS.
PROGRAM test IMPLICIT NONE INTEGER four four = 4 WRITE (*,*) four END PROGRAM
Whitespace and empty lines usually won't matter in F90 or above, but in rare cases errors will pop up. However, unlike many other languages such as C, C++, and Java, the line delimiter ';' is optional, so each line of code may stay on its own line!
- There is a GOTO command, but don't use it too much.
- Use DO loops early and often.
- Encapsulate your code into functions and subroutines making it easier to program at higher levels, and allowing others to understand whats going on.
- Comment your code well. Don't comment every line, but explain how everything works.