! 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.22
  program D22
    implicit none
    logical, parameter :: YES = .true.   ! named constant
    logical :: All_Equal
    integer, parameter :: Size_Of_Array = 5
    integer :: Loop
    real, dimension(Size_Of_Array) :: Array
! start program D22
    All_Equal = YES
    read (unit = *, fmt = *) Array
    do Loop = 2, Size_Of_Array
      All_Equal = merge( All_Equal, .false., Array(Loop) == Array(1))
    end do
    write (unit = *, fmt = *) " All elements equal? ", All_Equal
    stop
  end program D22

