! 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 5.31. Interaction between where and elsewhere blocks.
  program F31
    implicit none
    logical, dimension(4), parameter :: MASK = (/ .true., .false., .true., .true. /)
    real, dimension(5) :: X
!  start program F31
    X = 0.0
    where (MASK)
      X(2: 5) = X(2: 5) + 1.0
    elsewhere
      X(1: 4) = X(1: 4) + 2.0
    end where
    write (unit = *, fmt = *) X
    stop
  end program F31

