Factorial in Seed7

Example for versions Seed7 2012-01-01

This example uses built-in factorial function !n. It is defined only for integer data type, so trying to calculate 13! causes an overflow. The program output looks as follows:

0! = 1  
1! = 1  
2! = 2  
...
11! = 39916800  
12! = 479001600  
13! =  
*** Uncaught EXCEPTION NUMERIC_ERROR raised with
{! integer <80ba990>: <SYMBOLOBJECT> 0 }

{! (in integer <80ba990> param) } at factorial-builtin.sd7(10)
main no POSINFO
$ include "seed7_05.s7i";

const proc: main is func
local
    var integer: n is 0;
begin
    for n range 0 to 16 do
        writeln(n <& "! = " <& !n);
    end for;
end func;