开发者

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

开发者 https://www.devze.com 2023-01-31 14:03 出处:网络
In PHP I can do this: if (function1() && functio开发者_StackOverflown2()) { doSomething(); } If function1() returns false, then function2() will not be executed.

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

精彩评论

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