What are routine and subroutine in program?
<p>I am learning stack and hearing this word called "Subroutine" too much. I am confused: what are exactly "routine" and "subroutine" ? </p>

<p>Let's suppose I have a program :</p>

<pre><code>def tav(x):
    if x==0:
       return 19
    else:
       u=1
       tav(x-1)
       u+=1
tav(4)
</code></pre>

<p>So what are routine and subroutine in this program? I have read somewhere subroutine doesn't return anything so if I am getting right the inner portion of main function called subroutine or we can say directly subroutine is subprogram so in the above program subroutine should be:</p>

<pre><code>if x==0:
    return 19
else:
    u=1
    tav(x-1)
    u+=1
</code></pre>

<p>Am I getting it right?</p>

<p>Routines and subroutines are the same.
In older languages such as Fortran you had to differenciate between subroutines and functions. The latter returned something the former changed some state.</p>

python stack subroutine routines