Is it necessary to write else part in every if condition?

后端 未结 11 1617
-上瘾入骨i
-上瘾入骨i 2021-02-19 05:16

The question I asked might be closed, But i just want to know that is it necessary to write else part of every if condition. One of my senior programmer said me that \"you shoul

11条回答
  •  滥情空心
    2021-02-19 05:28

    No, you don't have to ..

    Also, I don't think that it is a good idea for readability, since you will have lots of empty else blocks. which will not be pretty to see.

提交回复
热议问题