[1] & and | are bitwise operators that occur in many programming languages.
Short circuit operators can reduce run times by avoiding unnecessary calculations.
They can also avoid Null Exceptions when expression 1 checks whether an object is valid.
Programmers can rewrite an if-then-else expression in a more concise way by using the conditional operator.
It should be read as: "If condition is true, assign the value of expression 1 to result.
: operator instead of an if-then-else statement if it makes your code more readable; for example, when the expressions are compact and without side-effects (such as assignments).
There are several rules that apply to the second and third operands in C++: There are several rules that apply to the second and third operands x and y in C#: The conditional operator of JavaScript is compatible with the following browsers: Chrome, Edge, Firefox (1), Internet Explorer, Opera, Safari, Android webview, Chrome for Android, Edge Mobile, Firefox for Android (4), Opera for Android, Safari on IOS, Samsung Internet, Node.js.
[4] the conditional operator can yield a L-value in C/C++ which can be assigned another value, but the vast majority of programmers consider this extremely poor style, if only because of the technique's obscurity.