The Benefits of Constants

前端 未结 14 2020
南笙
南笙 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:04

    Constants are immutable values which are known at compile time and do not change for the life of the program.

    Constants differ from variables in one significant way in that once a value has been assigned to a constant it cannot subsequently be changed.

    At runtime you can be sure that the value defined in a constant won't change and consequently your program won't break.

提交回复
热议问题