-
Notifications
You must be signed in to change notification settings - Fork 68
Description
The tutorial says
The syntax for declaring variables is:
<variable_type> :: <variable_name>
where <variable_type> is one of the built-in variable types listed above and <variable_name> is the name that you would like to call your variable.
In even the smallest programs one may have several variables of the same type, so I think it is worth introducing the syntax for this at the beginning. So the above could be changed to
The syntax for declaring variables is:
<variable_type> :: <variable_name_1>, <variable_name_2>
where <variable_type> is one of the built-in variable types listed above and <variable_name_1> and <variable_name_2> are the names that you would like to call your variables.
Then in the illustrative program
program arithmetic
implicit none
real :: pi
real :: radius
real :: height
real :: area
real :: volume
the declarations can be consolidated to one line. Modern Fortran has been criticized as verbose -- I think concise syntax should be used when it does not sacrifice clarity.
A nitpick about the code is that the line
area = pi * radius**2.0
should be
area = pi * radius**2
When you want to raise a value to an exact integer power, you should not write the exponent as a float.
Typo -- "running" not "runnning" (2 not 3 n's) at https://fortran-lang.org/learn/quickstart/arrays_strings .