Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   recursive code (http://www.alice.org/community/showthread.php?t=5463)

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?
Thanks,
mitchellA

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 07:01 PM.

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