! 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 2.2. Assignment statements with variable expressions.
  module C02M
    implicit none
    public :: Assign_2
  contains
    subroutine Assign_2( )
      ! Type declarations with initialization:
      real, save :: Y = 1.23, Pi = 3.141592
      integer, save :: Counts = 173
      character (len = 8), save :: I = " Optics "
      logical, save :: Flag = .true.
      ! Type declarations without initialization:
      real :: X, Theta
      integer :: Many
      character (len = 8) :: K
      logical :: Done
  ! start subroutine Assign_2
      X = Y  ! Real type
      Y = X
      Theta = Pi
      Many = Counts  ! Integer type
      K = I  ! Character type, length 8
      Done = Flag  ! Logical type
      write (unit = *, fmt = *) Y, Pi, X, Theta, Counts, Many, I, K, Flag, Done
      return
    end subroutine Assign_2
  end module C02M
