Carol Murphy wrote:they both decrement num as the end of each loop, so why do they act differently?
If tests a conditional once. While will loop until a condition becomes false.
Carol Murphy wrote:
Lines 8-9 & 10-11 are duplicates of each other?
What I see happening is the while looping until the condition becomes false, then stopping, then looping again if the condition becomes true when used in a recursive function.
The loop statement, on the other hand, never gets to the next statement, because it's still looping.
I ran the while version, and it looks like it is printing not 0's, but 1s. What platform are you using? Do they interpret 0s as 1s.