I am not too experienced with Fortran at the moment. This document will go over my knowledge of the Fortran language so far.
This document used various versions of the Fortran programming language. The version will be listed with each example.
Comments in Fortran are unique, but still easy to do.
C This is a single line comment
C Fortran does not support multi-line comments (as far as I know)
Fortran does not support comments after the first character in a line. Comments and source code can't be on the same line.
This example works with every version of Fortran.
Fortran does NOT support the break
keyword.
To this day, I am still not entirely sure what the break
keyword does, but most languages support it.
/!\ This example has not been tested yet, and may not work
A hello world program in Fortran is a bit more complicated than a Python or Perl Hello World program, but it isn't very difficult either. It is not similar to any language I am currently familiar with.
program helloworld
print *,'Hello World'
end program helloworld
This example is for Fortran 95 and up.
/!\ This example has not been tested yet, and may not work
Functions work like so in Fortran
FUNCTION myFunc(argument list)
print *, "Argument 1"
print *, "Argument 2"
END FUNCTION myFunc
return myFunc
STOP
This example is for Fortran 95 and up.
/!\ This example has not been tested yet, and may not work
The STOP
keyword goes at the end of a Fortran program to tell it to stop.
program genericProgram
print *, "Sample text"
end program genericProgram
STOP
This example is for Fortran 95 and up
/!\ This example has not been tested yet, and may not work
Booleans are defined like so in Fortran:
I don't know how to implement Booleans in Fortran yet.
/!\ This example has not been tested yet, and may not work
Fortran supports the int
keyword, but I don't know what it does.
int x = 1
This example is for Fortran 95 and up
/!\ This example has not been tested yet, and may not work
Fortran supports the integer
keyword, but I don't know what it does. I don't know what separates it from the int
keyword.
integer y = 2
This example is for Fortran 95 and up
/!\ This example has not been tested yet, and may not work
Fortran supports the goto
keyword. Back in the days of punch cards, people would write programs with a zero instead an o. These used to be valid, but were removed before Fortran 95
G0T0 10
This example is for FORTRAN I, II, III, and IV
/!\ This example has not been tested yet, and may not work
goto 10
This example is for Fortran 95 and up
/!\ This example has not been tested yet, and may not work
The majority of my Fortran knowledge comes from self-experimentation, and Wikipedia.
-
Fortran is not curly bracket and semicolon language
-
Fortran used to be spelled as FORTRAN, but was changed to lower case in the 1960s/1970a
-
Fortran is the 2nd oldest programming language that is still in development and is still in active use.
-
Fortran uses various file extensions, including
*.F
*f
*.FOR
*.for
*.f77
*.f90
*.f95
*.f02
*.f07
and more. -
Fortran is a language recognized by GitHub
-
I don't know if Fortran is an open source language or not
-
Fortran was created by IBM
-
Fortran started out as a punchcard language, as disk storage didn't exist yet
-
No other knowledge of Fortran at the moment.
File version: 1 (2022, Thursday, April 14th at 11:16 pm PST)
- Prepared a day early