I am learning how to catch exceptions, RecursionLimit::reclim in particular. To see how it works, I came up with the following example:
Clear[a] a = 1 test := Check[If[a > 100, a, If[RandomReal < 1, Print["yupeee"];Print[a], test]], a += 1; test] test
a I would like to count not how many times
Test has been called, but how many times recursion limit has been exceeded.
When I run it, I either get the output
$RecursionLimit::reclim: Recursion depth of 1024 exceeded. >> $RecursionLimit::reclim: Recursion depth of 1024 exceeded. >> $RecursionLimit::reclim: Recursion depth of 1024 exceeded. >> General::stop: Further output of $RecursionLimit::reclim will be suppressed during this calculation. >> 1117
I expected something like
but definitly not
Could someone please explain this strange number? Any idea how can I control the number of exceeded recursion limit? And since I am a beginner, PLEASE, try to make it simple.