How to write recursive factorial function in haskell without if then else statment

Viewed 3099
fac n = if n < 2 then 1 else n * fac (n-1)

main = do

   putStrLn "Enter a number: "  
   number <- getLine 
   print $ number >>= fac

I do not know how to write a recursive factorial function without if statements. Our professor said somethings about lambda calculus.

3 Answers
Related