7 lines
157 B
Text
7 lines
157 B
Text
func factorial(num: Integer): Integer {
|
|
require num >= 0;
|
|
match {
|
|
num == 0: return 1;
|
|
else: return num * factorial(num - 1);
|
|
}
|
|
}
|