[英]Why doesn't the shorthand arithmetic operator ++ after the variable name return 2 in the following statement?
[英]Using return in shorthand if statement doesn't work
我似乎无法理解为什么这样做:
if(n < i)
{
functoin();
}
else
{
return;
}
虽然这不起作用:
(n < i) ? function() : return;
为什么速记if语句不起作用?
return
不能在表达式中使用。 也许你可以尝试,
return (n < i) ? function() : undefined;
但是,只有你对每种情况都有一件事要做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.