What is the best way to replace or substitute if..else if..else trees in programs?

后端 未结 21 1190
迷失自我
迷失自我 2020-11-28 06:23

This question is motivated by something I\'ve lately started to see a bit too often, the if..else if..else structure. While it\'s simple and has its uses, somet

21条回答
  •  被撕碎了的回忆
    2020-11-28 07:13

    Outside of using a switch statement, which can be faster, none. If Else is clear and easy to read. having to look things up in a map obfuscates things. Why make code harder to read?

提交回复
热议问题