Alice Community  

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

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Passing Variables in a Recursive method
Posts: n/a
Default Passing Variables in a Recursive method - 05-31-2011, 08:38 AM

I'm experimenting with Alice to create a recursive method.

I created a frog that is supposed to say a Fibonacci sequence (10 levels using recursiveness). A Fibonacci sequence is 1, 1, 2, 3, 5, 8, et cetera, where the two last numbers are added together to create the next number.

I created the recursive method and set two variables to record the current value and the next number, but I'm failing to pass the number to the variables.

I tried _FibNumber set value to (_FibNumber + _FibLastNumber) for the next iteration, did not work, I even tried with 3 variables but when I test, the variable doesn't change. Any ideas?

I even tried to pass a regular number value to the variables but it just keeps coming back with the original value of one

Last edited by gransalamandra; 05-31-2011 at 08:39 AM. Reason: added information
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 ©2018, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.