Revert his changed yours is better and more readable, because his is 5x as long for the same logic
23
Anonymous1w
I could see a reason being legibility, but also fuck teammates that don’t communicate.
17
Anonymous1w
😂😂
6
Anonymous1w
Wouldn’t rand # & mod combo compile faster than nextBoolean?
6
Anonymous1w
Crash out
5
Anonymous1w
Something I like doing is splitting the ternary operator over multiple lines. Best of both worlds. Like this:
return random.nextBoolean()
? a
: b;
5
Anonymous1w
was there any justification?
3
Anonymous1w
Didn’t even omit the else block 💔💔
3
Anonymous1w
His is more quickly understandable
1
Anonymous1w
The first line isn’t even that hard to understand and is a lot cleaner. Your teammate is crazy
1
Anonymous#21w
He didn’t see it he said
9
AnonymousOP1w
Uh huh
4
Anonymous#61w
I guess but who’s doesn’t know how to read ternary operators ?
2
Anonymous#61w
No it's not, maybe if you're a sophomore, but anyone who is more than a novice coder can tell what a ternary expression is at a glance, and it has way less cognitive load to read and process than something 5 lines longer
6
Anonymous#61w
Now nesting ternary expressions gets hairy and hard to read fast, but one like this is almost always more readable than the long form. Especially when all the expressions involved are this short
13
Anonymous#71w
already did
11
Anonymous#61w
The one liner is way quicker to read. I don’t think we should stop using ternary operators just because some people are too lazy to understand what they mean even though it’s ridiculously simple