> For the complete documentation index, see [llms.txt](https://glados.guillaume-hein.fr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://glados.guillaume-hein.fr/features/recursivity.md).

# Recursivity

GoMelan supports recursivity.

```php
fn factorial(n: Int) -> Int
{
    if (n <= 1) {
        return 1;
    } else {
        return n * factorial(n - 1);
    }
}

fn main() -> Int
{
    return factorial(5);
}
```

**Output:**

```
120
```

1. Declare the factorial function.
2. Recursively calculating the factorial of n.
3. Call the factorial function in main with n=5.

{% hint style="info" %}
For more information on **recursivity**, please visit [this page](/features/recursivity.md).
{% endhint %}
