Do you consider this technique “BAD”?

前端 未结 28 1873
借酒劲吻你
借酒劲吻你 2021-02-02 10:57

Sometimes you need to skip execution of part of a method under certain non-critical error conditions. You can use exceptions for that, but exceptions generally are not

28条回答
  •  误落风尘
    2021-02-02 11:31

    Split your code into smaller chunks of functional elements - so you could split the above into a function that returns instead of breaking.

    I don't know if the above is bad practice but it's readability is a little off and may be confusing to others who might have to maintain the source.

提交回复
热议问题