`if` is strictly runtime, you need to use `when` in this case:
    
    
    proc createMyArray*(N: static[int]): array[N, int] =
      when N == 2:
        result = [1, 2]
      elif N == 3:
        result = [1, 2, 3]
    
    
    Run

Reply via email to