4.6) Example Of 'if statement' Testing
The following example (Example 8) is similar to Example 7 but with the addition of an else statement in the decision (see line 8).
1 program example8 2 real :: a 3 real :: b 4 a=10.0 5 b=5.0 6 if ( a > b ) then 7 print *, ‘a is greater than b’ 8 else 9 print *, ‘increase the value of a’ 10 endif 11 end program example8
Example of a program with If
and else
statements in the decision. See lines 6 to 10 for the If statement.
Example 8 is explained on the next page along with a video explanation.