开发者

`if` statement that doesn't execute other functions when condition is found to be false

In PHP I can do this:

if (function1() && functio开发者_StackOverflown2()) {
     doSomething();
}

If function1() returns false, then function2() will not be executed.

I have forgotten the name of this language feature... what do you call it?


This is called short-circuit evaluation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜