I was reading the explanations for: Understanding recursion in the beer bottle example, but I still don't understand the last part of the singSongFor function. When it reaches the final printf, why does it not simply print that there are 0 bottles in the bin because numberOfBottles is 0 after it prints that there are no more bottles of beer on the wall. I don't understand why it starts at 1 and why it increments when there is nothing increasing the value of numberOfBottles.
Asked
Active
Viewed 67 times
0
-
Look at what is assigned to `oneFewer` *before* the invocation of `singSongFor(oneFewer)` (that variable not needed, btw, as you could simply invoke `singSongFor(numberOfBottles-1)` ). – WhozCraig Feb 14 '14 at 19:19
-
So why does it not start at 4 then? – user2288153 Feb 14 '14 at 20:31
-
Nevermind. I managed to figure it out. – user2288153 Feb 14 '14 at 20:37