hassan Posted April 3, 2018 Share Posted April 3, 2018 Hi In Chapter 1 it discusses variable and constants. Why would you not simply assign a value to a variable and then not change it as opposed to defining a constant? or is there other benefits by defining constants? Link to comment Share on other sites More sharing options...
Larry Posted April 4, 2018 Share Posted April 4, 2018 It's a matter of protection: you never have to worry about a constant's value changing. Whereas you might think you've written code that wouldn't assign a value to a variable and then make a mistake. Constants also have global scope. Link to comment Share on other sites More sharing options...
Recommended Posts