3 ms·
I am not talking about ease of programming, and c being imperative, and the explicit break are edge cases. But for case value value can only be char or int, a
by nyrikki 2y ago
I am not talking about ease of programming, and c being imperative, and the explicit break are edge cases.
But for case value
value can only be char or int, and must be unique
Really it is just sugar for if-else-if, but if you enforce explicit break in your code it is as close to a provable total function as you get in C.
Total functions are the ideal in any code.
As determining whether or not a function F is total is undecidable, switch is more reliable than if-else-if ladders.