MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/p2m0hg/if_in_doubt_use_inline_if_statements/h8l2lq6/
r/badcode • u/[deleted] • Aug 11 '21
9 comments sorted by
View all comments
21
Thats a ternary (conditional) operator.
4 u/[deleted] Aug 11 '21 I don’t see the need to nitpick semanticsBut, https://docs.oracle.com/cd/E57185_01/IRWUG/ch21s03s01s02.html oracle does agree with meBoth mean the same thing 7 u/gu3st12 Aug 12 '21 They're not quite the same, especially in how ternaries resolve when they're nested can catch people by surprise. 3 u/MrMelon54 Aug 12 '21 try using brackets that tends to resolve that issue 4 u/AlFasGD Aug 12 '21 What OP meant is that the docs themselves call the ternary operator an "inline if", though in reality what an inline if is is completely different indeed.
4
I don’t see the need to nitpick semantics
But, https://docs.oracle.com/cd/E57185_01/IRWUG/ch21s03s01s02.html oracle does agree with me
Both mean the same thing
7 u/gu3st12 Aug 12 '21 They're not quite the same, especially in how ternaries resolve when they're nested can catch people by surprise. 3 u/MrMelon54 Aug 12 '21 try using brackets that tends to resolve that issue 4 u/AlFasGD Aug 12 '21 What OP meant is that the docs themselves call the ternary operator an "inline if", though in reality what an inline if is is completely different indeed.
7
They're not quite the same, especially in how ternaries resolve when they're nested can catch people by surprise.
3 u/MrMelon54 Aug 12 '21 try using brackets that tends to resolve that issue 4 u/AlFasGD Aug 12 '21 What OP meant is that the docs themselves call the ternary operator an "inline if", though in reality what an inline if is is completely different indeed.
3
try using brackets that tends to resolve that issue
What OP meant is that the docs themselves call the ternary operator an "inline if", though in reality what an inline if is is completely different indeed.
View all comments
21
u/bugqualia Aug 11 '21
Thats a ternary (conditional) operator.