Fib: Slide 3 of 6

<section>
<title>The <function>fib</function> Function</title>

<para>The heart of this program is the
recursive function that calculates the
members of the Fibonacci series.</para>

<para>The first and second members
of the Fibonnacci series are <quote>1</quote>;
all other values are calculated recursively.</para>

<src:fragment id="sub.fib">
sub fib {
    my $n = shift;

    if ($n <= 2) {
        return 1;
    } else {
        return <src:fragref linkend="sub.fib.recursion"/>
    }
}
</src:fragment>
</section>