| 1 | subroutine nested_if_example(x, y) |
| 2 | integer, intent(in) :: x, y |
| 3 | |
| 4 | if (x > 0) then |
| 5 | if (y > 0) then |
| 6 | print *, "Both x and y are positive." |
| 7 | else |
| 8 | print *, "x is positive, but y is not." |
| 9 | end if |
| 10 | else |
| 11 | if (y > 0) then |
| 12 | print *, "x is not positive, but y is positive." |
| 13 | else |
| 14 | print *, "Both x and y are not positive." |
| 15 | end if |
| 16 | end if |
| 17 | |
| 18 | end subroutine nested_if_example |