“如果”VS“否则如果” [英] "if' VS "else if"

查看:132
本文介绍了“如果”VS“否则如果”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被告知,使用if语句是首选,因为代码更难调试,当使用else if时?在这句话中有一丝道理吗?

解决方案

我从来没有问题调试'else if'语句。我认为使用else if语句是干净的,并且与读取else if语句组相互排斥的代码的程序员通信。


I'd been told, that using "if" statements is preferred , because of harder debugging of the code, when "else if" is used? Is there a grain of truth in this statement?

解决方案

I've never had issues debugging 'else if' statements. I think using 'else if' statements are clean and it communicates to a programmer reading the code that the group of 'else if' statements are mutually exclusive.

这篇关于“如果”VS“否则如果”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆