3
KAS89
6y

Static Recursion or While True?

Comments
  • 0
    What's the difference? Also what u mean by static recursion?
  • 0
    @beegC0de probably no exit conditions.
  • 2
    If the language uses tail calls then ill use recursion, otherwise I'd be worried about stack overflows
  • 0
    for (;;) {}
  • 1
    I always prefer iterative over recursion. However, it is about 5 times longer code and looks messy.
  • 1
    As @neriald said, iterating is always preferred for me for many many reasons, but static is the better of the two imo
  • 0
    Later I will figure out how to use a stack to iteratively walk a tree
  • 0
    Excellent answers ya'll. I prefer iteration as well. I do C# and static recursion is expensive. It holds the call stack and all. Simple while true is more than enough.
Add Comment