Skip to content

Commit

Permalink
+Factorial in Swift
Browse files Browse the repository at this point in the history
Added Factorial in Swift
  • Loading branch information
liamlutton committed Oct 11, 2017
1 parent 51211b7 commit 80fc3ad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions math/factorial/Swift/factorial.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
func factorial (n:Int) -> Int {
if n <= 1 {
return 1
}
return n * factorial(n: n-1)
}

0 comments on commit 80fc3ad

Please sign in to comment.