How to assign a variable in an IF condition, and then return it?

前端 未结 8 1341
野趣味
野趣味 2020-11-27 06:05
def isBig(x):
   if x > 4: 
       return \'apple\'
   else: 
       return \'orange\'

This works:

if isBig(y): return isBig(y)
         


        
8条回答
  •  Happy的楠姐
    2020-11-27 06:53

    This doesn't work due to intentional language design, but you can use this trick to get around this decision

提交回复
热议问题