The main documentation of the Valid_State_Status_Vector Procedure contains additional explanation of this code listing.
function Valid_State_Status_Vector (S) result(Valid) ! Input variable. type(Status_type), dimension(:), intent(in) :: S ! Status to be checked. ! Output variable. type(logical) :: Valid ! Logical state. ! Internal variable. type(integer) :: i ! Loop counter. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Start out true. Valid = .true. ! Check each element. do i = 1, SIZE(S) Valid = Valid .and. Valid_State(S(i)) end do return end function Valid_State_Status_Vector