Hi there,
is it possible to write a subroutine / function which 1) only accepts a discrete number of integer values as inputs and 2) allows to check this at compile time?
module test integer, parameter :: possible_value1 = 1, possible_value2 = 2 contains subroutine nice_routine (number) integer, intent(in) :: number end subroutine nice_routine end module test
In this example any integer number can be passed to the subroutine. Would it be possible to change it in such a way that only "possible_value1" and "possible_value2" are accepted and a compile-time error is issued for other values?
Thanks, Franz