Question d’entretien chez Adobe

How would you code a factorial function using no built in functions in R?