I see this algorithm in one answer, and now I have doubts Is a recursive function with two parameters, an integer array and a integer. The objective is to print the array but in the reverse order, I test it and it works! but I don't know why... Here is the function
public static void reverse(int[] a, int position) {
// BASE
if (position == a.length) return;
// RECURSIVE
reverse(a, position + 1);
System.out.println(a[position]);
}
}
if the condition is true, the return doesn't mean that the program will end? and if it's false, the function will do the recursive call without printing the number, or not? Thanks!