2 ms·
return a < b ? -1 : a > b ? 1 : 0; That's a nice approach. However the document is about Go, and Go doesn't have a ternary operator. So that probably leaves th
by pekim 7y ago
return a < b ? -1 : a > b ? 1 : 0;
That's a nice approach. However the document is about Go, and Go doesn't have a ternary operator. So that probably leaves the switch solution as the clearest one.