That example does not create a memory leak. There's no End statement. If you had an If:Then:Goto:End, you'd have a memory leak but an If:Goto does not have a leak.

Now, if it were to be
Code:
While
If
Goto
End

You'd have a memory leak because the End token is never reached for the While.
So, should I use the while command example that I used before, or the lbl and if statement example that you just replied to in my programs?
You really should consider structuring your program to get rid of Goto altogether.
Would this cause a memory leak? It's valid syntax but I can't exactly test to see if it causes a leak:

Code:

1->B
Lbl 0
If not(B
End
If B:Then
0->B
Goto 0
End
Yes, because Goto 0 is nested inside an If:Then:End block.
DJ_O wrote:
Yes, because Goto 0 is nested inside an If:Then:End block.


Well yes, but that wasn't the point of it-- what about the End statement? TI-BD states that

Quote:
...when the calculator reaches the End command for the associated loop/conditional, it not only removes it from the stack, but also returns that memory back to the calculator.


Following this logic, wouldn't the calculator count the End statement (which is skipped the first time around) as an end to the loop?
There will be no memory leak. When it reaches the End, regardless of where that is, the calculator will indeed pop the information about the conditional off the stack.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement