if->return vs. if->else efficiency

后端 未结 6 1189
一整个雨季
一整个雨季 2020-12-28 12:35

This may sound like a silly question, and I hesitated to post it, but still: if something needs to run only in a certain condition, which of these is more efficient:

6条回答
  •  庸人自扰
    2020-12-28 13:09

    The real question is, should you really care?

    I say NO! It's more important to have better readable code than doing some micro-optimization.

提交回复
热议问题