I've noticed a fluency in much older devs that they can look at an if-else block and quickly see a more concise way to structure the logic.
Apart from truth tables and experience, are there any techniques 开发者_如何学运维to become proficient in this?
Gain a good understanding of De Morgan's laws.
Another point to remember is that having a single return point from a function is somewhat overrated - not adhering to that can simplify your logic significantly.
Apart from that... experience... reading other peoples code.
精彩评论