Here is a recursive function -
private void printVar01(int t){
if(t != 0){
logp.info("o: " + t);
printVar01(t-1);
}
}
The same function with a slight modification -
private void printVar02(int t){
if(t != 0){
logp.info("o: " + t);
printVar02(t--);
}
}
If I pass in a integer value, like 4, printVar01 works as expected, where t decrements to 0 in successive recursive calls, eventually causing the program to exit.
With printVar02, t stays at value 4.
Why? I am assuming this has something to do with variable assignment and/or how values are passed to functions.