if / then / else
Executes code based on a condition.
Syntax
if (condition) then ... else ... end if
Description
Condition inside parenthesis. Comparison == /= < > or .eq. .ne.; logic .and. .or. .not.
Example
Loading editor…
Expected output
odd
When to use?
Flow branching.