Ruby - Class Methods and Variables
Identify the error in this Ruby code snippet:
name = "Alice" name.freeze name[0] = 'M' puts name
name = "Alice" name.freeze name[0] = 'M' puts name
name is frozen, so it cannot be changed after name.freeze.name[0] = 'M' modifies the string, which is forbidden and raises a runtime error.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions