operator for enums
问题 Just out of curiosity, asking this Like the expression one below a = (condition) ? x : y; // two outputs why can't we have an operator for enums? say, myValue = f ??? fnApple() : fnMango() : fnOrange(); // no. of outputs specified in the enum definition instead of switch statements (even though refactoring is possible) enum Fruit { apple, mango, orange }; Fruit f = Fruit.apple; Or is it some kind of useless operator? 回答1: I can't say I've ever wanted such an operator - which would be