89

减少该死的 if else 嵌套 - 简书

 6 years ago
source link: https://www.jianshu.com/p/57c065b124c4
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
写在前面 不知大家有没遇到过像“横放着的金字塔”一样的if else嵌套: 我并没夸大其词,我是真的遇到过了!嵌套6、7层,一个函数几百行,简!直!看!死!人! if else作为每种编程语言都不可或缺的条件语句,我们在编程时会大量的用到。但if else一般不建议嵌套超过三层,如果一段代码存在过多的if else嵌套,代码的可读性就会急速下降,后期维护难度也大大提高。所以,我们程序员都应该...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK