Noob with a stupid question

Stupid question time! I love this part… ok.

The difference between a variable and a constant? I see both describe something, like a noun, but a constant is Capitalized. So I did notice a difference as I tried to give an example below:

Bill = “123 Anywhere St., New York, NY 123456”
bill = 100_dollars

“Bill” is a place, I get that. It doesn’t change. But “bill” would not either. It is defined as a 100 dollar bill. Maybe I am thinking too hard. Thanks in advance.

Constant is used for a value that won’t likely to change throughout the program’s running life. Like you’d put Pi = 3.14 as a Constant cause this value is not going to change as more code is being executed. Variable is used to hold everything else

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs