why can't conditional operator be used as a statement
conditional-operator, conditional-statements, language-agnostic, types
Solution
`C` and `C++` do allow such constructs. As long as `doXyz()` and `doAbc()` return the same type. Including `void`.
Problem
Why can't the conditional operator be used as a statement? I would like to do something like: ``` boolean isXyz = ...; ... isXyz ? doXyz() : doAbc(); ``` where `doXyz` and `doAbc` are return void. Note that this is not the same as other operators, for example doXyz() + doAbc() intrinsically needs that doXyz and doAbc return a number-like something to operate (or strings to concatenate, or whatever, but the point is that + actually needs values to operate on). Is there something deep or is it just an arbitrary decision. Note: I come from the Java world, but I would like to know if this is possible in your favourite programming language.