function [ y ] = recursiveFactorial( x )
%recursiveFactorial compute x factorial

  % check x>=0, else we can get stuck in an infinite loop
  if x < 0
      error('factorials of positive numbers only')
  end
  
  if x <= 1
      y = 1;
  else
      y = x * recursiveFactorial( x-1 );
  end
  

end

