when is it best to use a recursive function vs a for loop jackpot ( @jackpot@lemmy.ml ) Programming@programming.dev • 10 months ago message-square21fedilinkarrow-up122
arrow-up122message-squarewhen is it best to use a recursive function vs a for loop jackpot ( @jackpot@lemmy.ml ) Programming@programming.dev • 10 months ago message-square21fedilink
minus-square bizdelnick ( @bizdelnick@lemmy.ml ) linkfedilink4•10 months agoIMHO almost never. Except for tree traversal, maybe.
minus-square livingcoder ( @livingcoder@programming.dev ) linkfedilink2•10 months agoI would agree. Only if the performance is extremely similar but the readability (for some reason) is significantly better for the recursive solution would I choose that.
IMHO almost never. Except for tree traversal, maybe.
I would agree. Only if the performance is extremely similar but the readability (for some reason) is significantly better for the recursive solution would I choose that.