!------------------------------------------------------------------------------
!
!  Program name:
!
!    chequerboard
!
!  Purpose:
!
!    This program demonstrates the use of array sections.
!
!    It generates an 8x8 chequer board, with 'B' and 'W' in
!    alternate positions. Assume the first position is 'B'.
!
!------------------------------------------------------------------------------

PROGRAM chequerboard

  IMPLICIT NONE
  CHARACTER (LEN = 1) , DIMENSION (8,8) :: chboard

  ! Version 1: 4 statements:
  WRITE(*,'(''Version 1 - 4 statements: ''//)')

  chboard (1:8:2,::2) = 'B'
  chboard (2:8:2,::2) = 'W'
  chboard (1:8:2,2::2) = 'W'
  chboard (2:8:2,2::2) = 'B'

  WRITE(*,'(8A4)') chboard

  ! Version 2: 3 statements:
  WRITE(*,'(//''Version 2 - 3 statements: ''//)')

  chboard = 'B'
  chboard (2:8:2,::2) = 'W'
  chboard (1:8:2,2::2) = 'W'

  WRITE(*,'(8A4)') chboard

END PROGRAM chequerboard
