`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
- Compile-time if and/or syntax conflicts Psirus
- Compile-time if and/or syntax conflicts Yardanico
- Compile-time if and/or syntax conflicts lqdev
