**by @kodeazy**

# flutter what is recursion and an example program on factorial of a number in dart?

- A function calling itself is called recursion.
- A factorial of a number
`n`

means`n*(n-1)*(n-2)*..*1`

. -
Below is a sample example for creating factorial of a number using recursion.

`void main() { int result = factorialUsingRecursion(5); print('factorial is $result'); } int factorialUsingRecursion(int number) { if (number > 1) return number * factorialUsingRecursion(number - 1); else return 1; }`

`Output:`

`factorial is 120`