Today I had continued with Fortran for Scientific Computing and learned about
- Character datatype
- Logical datatype and operators
- Conditional Statements
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
len_trim and so on.
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.
The fortran code has two ways of having if statements
Inline (logical if)
The iterations are carried through either
I also attempted the quizzes which gave insights to the various little things by which fotran may differ from, say, python.