RosettaCodeData/Task/Compile-time-calculation/Ada/compile-time-calculation-2.ada

17 lines
355 B
Ada

with Ada.Text_Io;
procedure CompileTimeCalculation is
function Factorial (Int : in Integer) return Integer is
begin
if Int > 1 then
return Int * Factorial(Int-1);
else
return 1;
end if;
end;
Fact10 : Integer := Factorial(10);
begin
Ada.Text_Io.Put(Integer'Image(Fact10));
end CompileTimeCalculation;