if-return 语句

if(A > B):
    return A+1
return A-1

or

if(A > B):
    return A+1
else:
    return A-1

++++++++++++++++++++++++++++++++++++++++++


1# Bad
if (foo)
  return 1
else
  return 2

2# Good
if (foo)
  return 1
return 2

3# Good
return 1 if foo else 2
 
原文地址:https://www.cnblogs.com/xinping-study/p/9259106.html