Possible Duplicate:
Throw exception when re-assigning a constant in Ruby?
When we use a capital letter word in ruby, it is a constant: CONSTANT = "alive"
. When I modify this "supposed" constant, it gives an error, but modifies it anyway:
(irb):27: warning already initialized constant CONSTANT
=> "13"
.
This seems like an odd behavior. If I am designing a game and need a value to be constant, say: Cheatcode_health = true
, and by accident, the value gets assigned as false
or 0
, it would be an unusual behavior. There could be lot of implications. In short is there a true constant in Ruby?