! Program Example from "Essential Fortran 90 & 95" by Loren P. Meissner
! Copyright 1996. Copying for sale requires permission from the author.
! Otherwise, distribution is permitted if these three lines are included.

! Example 3.25.
  program D25
    implicit none
    real, parameter :: X = 1.0, G = 4.99
    real :: Y
    logical :: Flag, Logical_Variable, Goal_Test
    logical, parameter :: GOAL = .false.
! start program D25
    Flag = (X == 0.0)  ! Use of parentheses is optional.
    Logical_Variable = Flag
    Goal_Test = (GOAL .or. Logical_Variable)
    Goal_Test = ((G >= 0) .and. (G <= 5.0)) .and. (.not. Flag)
    Logical_Variable = (Logical_Variable .and. (G > 1.0))
    if (Flag) then
      Y = 1.0
    else
      Y = 0.0
    end if
    write (unit = *, fmt = *) Flag, Goal_Test, Logical_Variable, Y
    stop
  end program D25
