can't modify frozen string : freeze « String « Ruby






can't modify frozen string


greet = "Hello, myValue!"
greet.freeze
greet.concat("!") # => TypeError: can't modify frozen string

 








Related examples in the same category

1.Make a string immutable with Object's freeze method
2.Freeze a string
3.is the object frozen?
4.rescue a Attempting-to-modify exception