I found a code here Printing 1 to 1000 without loop or conditionals
Can someone please explain how compile time recursion works, couldn\'t find it in google
You have factorial calculation explained here.
btw that a note that your function doesn't work for negative numbers.