4.4) Example of Making Decisions
When the program reaches line 6, it tests what is inside the round brackets to see if it is true. If the test is true (i.e. a > b) then it goes inside the if statement
and performs the printing to the screen. If the test is false (i.e. b > a) then the print statement is ignored and the code jumps to line 8 and then continues in the program.
1 program example7 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 endif 9 end program example7