为什么回报会跳过三元运算符产生的价值?(Why is return skipping the value produced in my ternary operator?)
我有这样的代码:
def FirstFactorial(num) num == 0 ? 1 : num * FirstFactorial(num - 1) return num end
但是,结果不断返回原始参数。 我怎样才能返回我的三元运算符创建的结果?
I have this code:
def FirstFactorial(num) num == 0 ? 1 : num * FirstFactorial(num - 1) return num end
however, the result keeps returning the original argument. How can I return the result created by my ternary operator?
原文:https://stackoverflow.com/questions/31013416
更新时间:2021-11-21 20:11