jackpot@lemmy.ml to Programming@programming.dev · 11 个月前when is it best to use a recursive function vs a for loopmessage-squaremessage-square52fedilinkarrow-up133arrow-down13
arrow-up130arrow-down1message-squarewhen is it best to use a recursive function vs a for loopjackpot@lemmy.ml to Programming@programming.dev · 11 个月前message-square52fedilink
minus-squarebizdelnick@lemmy.mllinkfedilinkarrow-up10arrow-down2·11 个月前IMHO almost never. Except for tree traversal, maybe.
minus-squarelivingcoder@programming.devlinkfedilinkarrow-up2·11 个月前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.
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.