<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by aakash on Medium]]></title>
        <description><![CDATA[Stories by aakash on Medium]]></description>
        <link>https://medium.com/@aakash201701?source=rss-b3b1872a65a2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ppyQPpXZ9eE1mQR3vldoqg.jpeg</url>
            <title>Stories by aakash on Medium</title>
            <link>https://medium.com/@aakash201701?source=rss-b3b1872a65a2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 21:52:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aakash201701/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Understanding Recursion]]></title>
            <link>https://medium.com/@aakash201701/understanding-recursion-5172981b9741?source=rss-b3b1872a65a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5172981b9741</guid>
            <category><![CDATA[recursion]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[freecodecamp]]></category>
            <category><![CDATA[first-post]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[aakash]]></dc:creator>
            <pubDate>Wed, 26 Jul 2017 10:01:15 GMT</pubDate>
            <atom:updated>2017-07-26T10:01:15.356Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*1Cje7pTC_ddHe6yp687dIg.jpeg" /><figcaption><strong>Mirror</strong> in the <strong>Mirror</strong></figcaption></figure><p>This being my first post on programming, I decided to help my readers in understanding the topic of recursion in my own way since it was one of those topics which gave me a tough time in understanding it. So lets begin:</p><h4><strong>What is Recursion -_- </strong>?</h4><p>In simple words, recursion is the process in which <strong>a function calls itself till a given condition is met or infinity</strong>(<em>in case if it lacks a proper condition</em>).</p><p>To understand this better, lets solve a basic example of</p><p><a href="https://en.wikipedia.org/wiki/Factorial"><strong>Finding factorial of a given number</strong></a><strong>:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e18db272688da6d0d27c74a376e1f83/href">https://medium.com/media/9e18db272688da6d0d27c74a376e1f83/href</a></iframe><p>Above is a simple JavaScript function which is given the argument ‘ 3 ’.</p><p>So what happens next ?</p><p><strong>Step 1</strong>: The number ‘ 3 ’ gets passed to the function and first the condition <em>that if it is greater than ‘ 1 ’ is checked.</em></p><p>Since it is true, it goes to the next step where a return statement is being called with an expression <strong>(3 * factorialize(3–1)). And this is the most important part of recursion.</strong>Basically return statement is the point where the function calls itself again.In this our case there is an expression i.e <strong>3 * factorialize(3–1).</strong></p><p><strong>Step 2</strong>: Now at this point, before the expression is resolved, the function is again called, now with a different value <strong>(i.e 3–1=2)</strong> being passed as an argument. Below is an illustration how our function <strong>“</strong> <strong>virtually</strong> <strong>”</strong> looks like</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac7ce439997b38ae8e7535b9e19f6cc1/href">https://medium.com/media/ac7ce439997b38ae8e7535b9e19f6cc1/href</a></iframe><p>So, this continues till the if condition is false at which the function returns one. So the expression gets solve in the following order:</p><p><strong>3*(2*(1))) = 6</strong>, and there we go. Recursion is generally chosen over <a href="https://www.tutorialspoint.com/computer_programming/computer_programming_loops.htm"><strong>Loops</strong></a> by the developer since it is believed to be robust.</p><p>Hope this post was helpful to move a step forward in your <strong>developer journey</strong>! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5172981b9741" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>