avoiding if statements

前端 未结 24 748
心在旅途
心在旅途 2021-01-30 08:39

I was thinking about object oriented design today, and I was wondering if you should avoid if statements. My thought is that in any case where you require an if statement you ca

24条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-30 09:43

    Surely some form of comparison needs to be made regardless of what you do? In the end ... sure you can avoid if statements but you'd be producing code that is IDENTICAL to the code using an if statement.

    Someone correct me if im wrong but I can't think of a time where you could get any win form doing this.

提交回复
热议问题