title: How to create name of subroutine or function in every step of do loop
body: <p>My IDE is:</p>
  
  <p>Code::Blocks 17.12 ( with tdm-gcc-5.1.0-3 )</p>
  
  <p>The example code is:</p>
  
  <pre><code>program test_code
  
  implicit none
  
  integer                 :: i
  integer,      parameter :: nn = 3
  integer                 :: tmp_array(nn)
  character(11)           :: name_tmp
  character(*), parameter :: fmt_tmp = '("fun_name_",i2.2)'
  
  do i = 1, nn
  
  ! solution - if statement
  
    if ( i == 1 ) tmp_array(i) = fun_name_01(nn,i)
  
    if ( i == 2 ) tmp_array(i) = fun_name_02(nn,i)
  
    if ( i == 3 ) tmp_array(i) = fun_name_03(nn,i)
  
    write(*,*) tmp_array(i)
  
  ! solution - avoid if statement
  
    write( name_tmp, fmt_tmp ) i
  
    tmp_array(i) = name_tmp(nn,i)
  
    write(*,*) tmp_array(i)
  
  end do
  
  contains
  
  function fun_name_01(nn_tmp,i_tmp) result(result_tmp)
  
    integer, intent(in)  :: nn_tmp, i_tmp
    integer              :: result_tmp
  
    result_tmp = nn_tmp + i_tmp
  
  end function fun_name_01
  
  function fun_name_02(nn_tmp,i_tmp) result(result_tmp)
  
    integer, intent(in)  :: nn_tmp, i_tmp
    integer              :: result_tmp
  
    result_tmp = nn_tmp + i_tmp
  
  end function fun_name_02
  
  function fun_name_03(nn_tmp,i_tmp) result(result_tmp)
  
    integer, intent(in)  :: nn_tmp, i_tmp
    integer              :: result_tmp
  
    result_tmp = nn_tmp + i_tmp
  
  end function fun_name_03
  
  end program test_code
  </code></pre>
  
  <p>After building project I got this error message:</p>
  
  <p><code>C:\Users\aleks\Desktop\test_code\main.f95|25|Error: Unclassifiable statement</code></p>
  
  <p>What I want to do is avoiding if statement for every function with different name.
  Is there any way, first to write a function name into a variable <code>name_tmp</code> in each step up to a do loop, and after that to use that variable as the name of the function being called?</p>