Find limit of recursion: Difference between revisions

Ada solution added
(Ada solution added)
Line 1:
{{task}}{{selection|Short Circuit|Console Program Basics}}[[Category:Basic language learning]][[Category:Programming environment operations]]Find the limit of recursion.
 
=={{header|Ada}}==
<lang Ada>
with Ada.Text_IO; use Ada.Text_IO;
 
procedure Test_Recursion_Depth is
function Recursion (Depth : Positive) return Positive is
begin
return Recursion (Depth + 1);
exception
when Storage_Error =>
return Depth;
end Recursion;
begin
Put_Line (Integer'Image (Recursion (1)));
end Test_Recursion_Depth;
</lang>
Sample output:
<pre>
Recursion depth on this system is 524091
</pre>
=={{header|AutoHotkey}}==
<lang AutoHotkey>Recurse(0)