开发者

How to quickly recognise redundant flow control blocks?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜