Recursion

The function body can include calls to other functions and calls to itself. This is referred to as recursion.

function b=factorial(a)
      if a==1   
         b=1
      else   
         b=factorial(a-1)*a
      end
end