Announcements
Hi,
I started working with linear programming inside of BC and the procedure I created is a recursive procedure that receives an integer and a list as parameters.
Now the problem is the following.
The Recursive procedure works with the integer and the values are stored at the specific stages of the recursive procedure, but the the list value is kept to whatever was last removed.
Even when moving back to the beginning of the first loop. the list is not returned to the initially list values.
It might be that AL does not cater for storing Lists in recursive procedures but I could find any documentation to confirm it.
Hi,
"A List is a reference type, so assigning an instance of a list to another variable or passing as a method parameter by value (for example without var), creates a second variable that reads/writes the same list. It does not create a new list."
Hi Brad,
Yes, I set the first element in the list equal to origin and then I remove it from the list before passing it to the procedure again. this will continue until there is only one element left in the list where it will then return a decimal value.
I removed the var from the parameter and still got the same outcome.
Are you modifying the list within the procedure? You're passing the list as a reference (var), which will pass the same list reference for each recursive call.
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156