HegemonKhan wrote:(Since I'm currently between school symesters, I'm trying to get back into quest and progressing towards making a game)
In trying to avoid using recursion (as it piles up memory usage), and the issues with the 'while' Function's looping not waiting for its scripts to finish first, and thus the conflict with the 'get input ~ show menu', is the 'do~invoke' Scripts~Functions, an alternative?
How does the 'do~invoke' work in terms of memory usage? Are they Functions, and thus use recursion, being no different than all other Functions? Or, are they Method (Script Attribute) calls, which don't use recursion, and are like the looping programming, which doesn't use as much memory as recursion?
I wasn't able to get around to asking my programming professors~teachers, on how~why looping (do, do-while, for, foreach, etc) works in not wasting up (at least as much) memory, as recursion does. Don't loops have to store~save~preserve data like recursive Functions, thus piling up memory in the stack?
Also, in terms of operation efficiency (more ambigious ~ situational question, I know), is recursion better or are loops better? How much extra operations are occuring in terms of looping vs recursion vs how many variables and other assignment~whatever etc operations you're doing, if it's possible to give a generalized repsonse~answer on this type of stuff, of course.
*
* *
* * *
* * * *
* * *
* *
*
* * * *
* * *
* *
*
* *
* * *
* * * *
class Math {
addition (a, b) {
sum = a + b
math.addition ( (sum + a), (sum+b) )
// ignore its infinite looping issue
msg (sum)
}
}
jay wrote:You really don't want to push your memory usage into a paging situation, though, as the system will slow to a crawl, which will make your users very unhappy!