Revert his changed yours is better and more readable, because his is 5x as long for the same logic
23
Anonymous3d
I could see a reason being legibility, but also fuck teammates that don’t communicate.
17
Anonymous3d
😂😂
6
Anonymous3d
Wouldn’t rand # & mod combo compile faster than nextBoolean?
6
Anonymous3d
Crash out
5
Anonymous1d
Something I like doing is splitting the ternary operator over multiple lines. Best of both worlds. Like this:
return random.nextBoolean()
? a
: b;
4
Anonymous3d
was there any justification?
3
Anonymous3d
Didn’t even omit the else block 💔💔
3
Anonymous3d
His is more quickly understandable
1
Anonymous3d
The first line isn’t even that hard to understand and is a lot cleaner. Your teammate is crazy
1
Anonymous#23d
He didn’t see it he said
9
AnonymousOP3d
Uh huh
4
Anonymous#63d
I guess but who’s doesn’t know how to read ternary operators ?
2
Anonymous#63d
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#63d
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#73d
already did
11
Anonymous#63d
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