GaryLee's Blog
如何优化大量if-else代码结构? 如何优化大量if-else代码结构?
一、提前return适用场景:if-else代码结构包含return语句优点:优化代码阅读体验,如果if处理逻辑复杂不用拉到底才知道else是return逻辑例子代码: 优化前: if(condition) { // do sth
2023-07-31