by asattarmd · 2y ago · 0 comments
private String generateGuessSentence(char candidate, int count) {
if (count === 0) return "There are no " + candidate + "s";
if (count === 1) return "There is 1 " + candidate;
return "There are " + count + " " + candidate + "s";
}It just needs one tired / inexperienced / somethingelse coder to "quickly add" an extra call to the topmost if and then you'll have interesting issues.
I'll take the "ugly" braces every day compared to having risky structures like that in the code at all.
But easier maintainability I also favor braces everywhere.