We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 89259b3 commit c85d42aCopy full SHA for c85d42a
src/doc/rustdoc.md
@@ -51,7 +51,7 @@ Calculates the factorial of a number.
51
52
Given the input integer `n`, this function will calculate `n!` and return it.
53
"]
54
-pub fn factorial(n: int) -> int { if n < 2 {1} else {n * factorial(n)} }
+pub fn factorial(n: int) -> int { if n < 2 {1} else {n * factorial(n - 1)} }
55
# fn main() {}
56
~~~
57
0 commit comments