Factorial: Difference between revisions
Content added Content deleted
m (Solve bug for 0!) |
(→{{header|Coq}}: Added Coq example) |
||
Line 3,408: | Line 3,408: | ||
x: 5</syntaxhighlight> |
x: 5</syntaxhighlight> |
||
=={{header|Coq}}== |
|||
<syntaxhighlight lang="coq"> |
|||
Fixpoint factorial (n : nat) : nat := |
|||
match n with |
|||
| 0 => 1 |
|||
| S k => (S k) * (factorial k) |
|||
end. |
|||
</syntaxhighlight> |
|||
=={{header|Crystal}}== |
=={{header|Crystal}}== |