Ruby - String Operations
Identify the problem in this Ruby code snippet:
text = " Hello World" puts text.strip.upcase!
text = " Hello World" puts text.strip.upcase!
upcase! behaviorupcase! changes the string in place and returns nil if no changes were made.stripstrip returns a new string, so chaining upcase! on it may return nil if the string is already uppercase.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions