Open Denniszedead opened 2 years ago
Hello @Denniszedead ! I think ternary operators are more towards readability if you've just one simple condition that leads to either a true
or false
outcome. If there are more than the said outcome, it's better to use either if & else
or switch statements
. These are just my two cents!
Hi, is it recommended to use
predicate ? ifTrue : ifFalse
to improve code quality?
It is certainly allowed e.g., our coding standard does not object to its use. Does it increase code quality? Depends on the context.
Hi, is it recommended to use
predicate ? ifTrue : ifFalse
to improve code quality?