Am I immoral for using a variable name that differs from its type only by case?

前端 未结 10 1222
旧时难觅i
旧时难觅i 2021-02-11 11:58

For instance, take this piece of code:

var person = new Person();

or for you Pythonistas:

person = Person()

I

10条回答
  •  逝去的感伤
    2021-02-11 12:33

    I use it all the time for temporary object references. I would avoid it like the plague for primitive data types.

    Person person = new Person(); // okay
    
    int Int = 42; // pure evil
    

提交回复
热议问题