Alice Community

Alice Community (
-   How do I...? (
-   -   recursive code (

mitchellA 11-18-2010 01:36 PM

recursive code
1 Attachment(s)
I need help understanding recursive code. I completed the [I]Towers[/I] exercise as written in the book; and although it works, I do not understand why (to me the IF statement should execute once then stop, but the ELSE part executes until everything is finished???). My teacher also said the world.moveIt method could be shortened by using recursive code, but I am not sure how to accomplish that.
Could someone please explain in detail why the code works and perhaps provide some other examples and explainations?

PS: I have attatched the [I]Towers[/I] file just in case you are using a different book.

All times are GMT -5. The time now is 10:14 AM.

Copyright ©2021, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.