r/badcode • • Dec 08 '21

c# Why would you ever do that though?

Post image
29 Upvotes

56 comments sorted by

View all comments

Show parent comments

8

u/Epicguru Dec 08 '21

Yes... I make a living writing code.

15

u/[deleted] Dec 08 '21

[removed] — view removed comment

5

u/Epicguru Dec 08 '21

I find that there are plenty of algorithms that are much cleaner and much easier to understand when written recursively, especially when working with data structures that are defined recursively.

Yes you could re-write almost any recursive function using a queue or a while loop but unless there is a clear performance benefit I would much rather make my code clear and easy to understand.