Guest User

Untitled

a guest
Aug 16th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.12 KB | None | 0 0
  1. def factorial(n)
  2. n == 0 ? 1 : n * factorial(n - 1)
  3. end
  4.  
  5. # OR
  6.  
  7. def factorial(n)
  8. (n > 0 && n * factorial(n - 1)) || 1
  9. end
Add Comment
Please, Sign In to add comment