3 ms·
Couldn't you just break the ternary up? if a == b { return 0 } return a > b ? 1 : -1 Also it would be ~7 lines, not 10? if a > b { return 1 } el
by Vadoff 7y ago
Couldn't you just break the ternary up?
if a == b { return 0 }
return a > b ? 1 : -1
Also it would be ~7 lines, not 10?
if a > b {
return 1
} else if a < b {
return -1
} else {
return 0
}