If tests a conditional once. While will loop until a condition becomes false.
I think my misunderstanding begins here, with what happens once the condition becomes false. If returns up the stack without testing the values against the condition.
While will continue to check sqspin(num) against the conditional using the value of num returned by sqspin(1), thus causing a never-ending loop, because of the recursive call.
I tried running these both in Python Visualizer, and from what I could see they behave the same until they start returning up the stack.
I'm not able to visualize this statement: "While will loop until a condition becomes false. "
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.
I have always had the idea in the back of my mind that while and if worked pretty much the same way, and this makes me feel confused. Am I understanding this correctly?
I have another question about the way recursion works. Lines 8-9 & 10-11 are duplicates of each other, so 1 would be printed twice. When the program runs the numbers are printed
in descending order until 0 is reached, then they stop. The program continues running until the calls on the stack return, but nothing more gets printed. Is there any significance
to lines 8-11 in the code you posted? Why the duplication if no number is being printed?