Jump to content
Larry Ullman's Book Forums

Recommended Posts

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?

 

 

 

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...