Ruby - String Operations
Identify the error in this Ruby code:
name = "Alice" name.freeze name.upcase!
name = "Alice" name.freeze name.upcase!
freeze method is correctly called on the string name, making it immutable.upcase! method tries to change the string in place, which is not allowed on a frozen string, causing a runtime error.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions