1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
(:*******************************************************:)
(: Test: function-declaration-012.xq :)
(: Written By: Pulkita Tyagi :)
(: Date: Thu Jun 2 00:24:56 2005 :)
(: Purpose: Demonstrate function declaration in different combination :)
(:********************************************************************:)
declare function local:fn1 ($n as xs:integer) as xs:integer
{
local:fn2($n)
};
declare function local:fn2 ($n as xs:integer) as xs:integer
{
if ($n = 1)
then 1
else $n + local:fn1($n - 1)
};
local:fn1(4)
|