Today I had continued with Fortran for Scientific Computing and learned about
- Character datatype
- Logical datatype and operators
- Conditional Statements
Character Datatypes
The character dataypes are declared as either a single character or as an array of particular length.
|
|
Two main points about strings are that,
- if the length of string input is less than specified, the remaining is filled by space.
- If it greater than the specified length, only the specified length is read and rest is discarded.
Also, I learnt about functions such achar
, iachar
, trim
, len_trim
and so on.
Logical statements
The logical statements are verbose and hence it is very easy to read how they work. In the following code, read .eqv.
as “equivalent” and .neqv.
as not equivalent. The rest will be easy to understand.
|
|
Conditional Statements
The fortran code has two ways of having if statements
Multiline
|
|
Inline (logical if)
|
|
Iterations
The iterations are carried through either
|
|
or the
|
|
I also attempted the quizzes which gave insights to the various little things by which fotran may differ from, say, python.