I have taken a piece of code from http://www.s-anand.net/euler.html, problem 5:
def gcd(a,b):
print a,b
return b and gcd(b, a % b) or a
print gcd(10,20)
Giving output:
10 20
20 10
10 0
10
Why the last line prints only “a” not b.
Can you please explain how the return statement in above code works.
I am little bit confused with “and” and “or” operators.
was the old way of writing: