Dealing with nested if then else/nested switch statements

前端 未结 7 1523
走了就别回头了
走了就别回头了 2020-12-30 08:43

Are there any design patterns/methods/ways to remove nested if then else conditions/switch statements?

I remember coming across some methods used by the Google folks

相关标签:
7条回答
  • 2020-12-30 09:09

    Have you read this on flattening arrow code from Coding Horror?

    You can replace throw with return or goto if you're using a language without exceptions.

    0 讨论(0)
提交回复
热议问题