<?xml version="1.0" encoding='utf-8'?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="Recursion - Page 28 - Wikipedia">
<p>
<a accesskey="1" href="page.php?w=recursion&amp;p=27">1.Previous</a><br />
<a accesskey="3" href="page.php?w=recursion&amp;p=29">3.Next</a>
</p>
<p>larger and larger instances, until the desired size is reached.</p>

<p>A classic example of recursion is the definition of the <a href="page.php?w=factorial">factorial</a> function, given here in <a href="page.php?w=Python_%28programming_language%29">Python</a> code:</p>

<p><syntaxhighlight lang="python3">def factorial(n):    if n > 0:        return n * factorial(n - 1)    else:        return 1  </syntaxhighlight></p>

<p>The function calls itself recursively on a smaller version of the input  and multiplies the result of the recursive call</p><p>
<a accesskey="1" href="page.php?w=recursion&amp;p=27">1.Previous</a><br />
<a accesskey="3" href="page.php?w=recursion&amp;p=29">3.Next</a>
</p>

<do type="prev" label="Search">
        <go href="search.wml"/>
</do>

</card>
</wml>
