I have this code:
public void myFunction(String label, String type, string command, int attempts = 0)
{
try
{
Utility.Logger("myFunction attempt " + attempts.ToSafeString() + " label " + label + " type " + type, command);
...stuff...
}
catch (Exception e)
{
if (attempts < 10)
return myFunction(label, type, command, attempts++);
else
return null;
}
}
As you can see, I have a recursive call in the catch branch, where I set a parameter a counter = counter + 1.
The weird point is I have always attempts = 0 in my log. Why? What am I missing?