3 ms·
I think part of the problem is that it'sn't visually obvious that ? and especially : are lower precedence than < and >. I suspect that most of the people with g
by a1369209993 8y ago
I think part of the problem is that it'sn't visually obvious that ? and especially : are lower precedence than < and >. I suspect that most of the people with genuine objections would feel better about:
a<b ? -1 : a>b ? +1 : 0
# or maybe
a < b ?? -1 !! a > b ?? +1 !! 0 # perl6 style
# or
a < b then -1 else a > b then +1 else 0
not for verbosity vs succinctness but for the mnemonic that visually-smaller operators bind more tightly.