void main() {
print(factorial(6));
}
factorial(number) {
if (number <= 0) {
// termination case
return 1;
} else {
return (number * factorial(number - 1));
// function invokes itself
}
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/266189.html