Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Thread Tools Display Modes
recursive code
Posts: n/a
Default recursive code - 11-18-2010, 02:36 PM

I need help understanding recursive code. I completed the Towers 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 Towers file just in case you are using a different book.
Attached Files
File Type: a2w TowersToPostTST.a2w (111.5 KB, 15 views)
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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