In mastery 21 I explained what a recursion is, and as I said before, a recursion helps our code to look cleaner and easier for other users to understand, but it is not always the best option to use.
If we want our code to look better yes, but some times we have to make it longer in order to be more effective, what do I mean by that?
For example, if we did code fore an airbag of a car, this code must be as faster as it can, everything has to happen in miliseconds or even nanoseconds if possible.
Here is an example of 2 different functions that do the same thing..
In the first function we can notice that it is using recursion which looks shorter and easier to understand, but the second function, even if it looks rare, it is more effective and it can solve the function faster.
#TC1014 #mastery22