The Benefits of Constants

前端 未结 14 1876
南笙
南笙 2021-02-04 07:46

I understand one of the big deals about constants is that you don\'t have to go through and update code where that constant is used all over the place. Thats great, but let\'s s

14条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-04 08:06

    If you declare something as a constant, and then accidentally attempt to modify its value in your code, the compiler will tell you about your mistake. This form of static type checking is actually the main reason for using constants.

提交回复
热议问题