Question: Function - Recursion


My teacher gave us an assignment in which he asked us to write a function "factorielle" (which calculates factorials) using recursion.

Having written the function in Maple 12 according to previous instructions that had been given to us:

> factorielle:=n->if n=0 then 1 else n*factorielle(n-1) fi;

I got the following message: "error, invalid arrow procedure." (there's a box around "n->if")
What is strange is that my function corresponds to the correction that was distributed to us by my teacher...

I know that my teacher uses a relatively older version of Maple but does that account for the error message?

If the function I suggested is wrong, could you please suggest another way (using recursion) to write out the function?

I am really new to Maple therefore the problem may be due to something else (like perhaps my lack of knowledge concerning Maple...). My studies are in French therefore I may not be using the appropriate terms in English. Please let me know if anything is unclear in my post.


Please Wait...