How this greatest common divisor (gcd) works in python
<p>I have taken a piece of code from <a href="http://www.s-anand.net/euler.html" rel="nofollow">http://www.s-anand.net/euler.html</a>, problem 5:</p>

<pre><code>def gcd(a,b): 
    print a,b
    return b and gcd(b, a % b) or a

print gcd(10,20)
</code></pre>

<p>Giving output:</p>

<pre><code>10 20

20 10

10 0

10
</code></pre>

<p>Why the last line prints only "a" not b.</p>

<p>Can you please explain how the return statement in above code works.</p>

<p>I am little bit confused with "and" and "or" operators.</p>
