<Example Program 1>

Program if_construct_example_1
    Integer x
    Read *, x
   
If (Mod(x,2)==0) Then
        Print *, 'even',x
   
Else If (x<0) Then
        Print *, 'odd negative',x
   
End If
End

Example Input 1

4

Execution Results

  even 4

Example Input 2

-7

Execution Results

  odd negative -7

<Example Program 2>

Program if_construct_example_2
    Integer x
    Read *, x
   
eventest: If (Mod(x,2)==0) Then
        Print *, 'even'
       
If (x==4) Then
            Print *, 'four'
       
End If
    End If eventest

End

Example Input 1

2

Execution Results

  even


Example Input 2

4

Execution Results

  even
  four