`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
.
精彩评论