DOI link for Introducing Objects
Introducing Objects book
Maria: We’re quite excited about showing you our homework today because we came up with several solutions and we’re not sure which is best.
Professor: Let me see.
Maria: Here’s the first one:
Professor: That’s a pretty forthright solution. I have one question, though. If a and b are equal, then the else part is executed and b becomes zero. From here on, neither a nor b can change and you’re stuck inside an infinite loop. Have you thought of that?