Best way to check if a Variable is nil?

后端 未结 2 1689
遇见更好的自我
遇见更好的自我 2020-12-11 14:44

A common condition that all programs should do is to check if variables are assigned or not.

Take the below statements:

(1)

         


        
2条回答
  •  佛祖请我去吃肉
    2020-12-11 15:08

    As far as performance, there is no difference. I personally prefer the second form as I find that humans can parse the meaning quicker.

提交回复
热议问题