Short-circuit operator

Updated: 04/26/2017 by Computer Hope

A short-circuit operator is used in some programming languages to execute a second argument when the outcome of the first statement is not sufficient to evaluate the full expression. It provides users developing the program with more control over how expressions and arguments are processed.

A standard expression may say if x is true, then the entire expression is true. However, where the generalization for one argument outcome may not be enough, a short-circuit operator may be used. An example is if x then y else false. The short-circuit operator allows the program to evaluate the first argument, along with any side effects of that argument, and then move on to evaluate the second argument, if necessary.

Programming terms