Here is a recursive funtion -
private void printVar01(int t){
if(t != 0){
logp.info("o: "+t);
printVar01(t-1);
}
}
Same funtion with a slight modification -
private void printVar02(int t){
if(t != 0){
logp.info("o: "+t);
printVar02(t--);
}
}
If I pass in a interger value like 4, printVar01 works as expected, where t decrements to 0 in successive recrsive 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 funtions.