Ruby - Methods
Consider this Ruby code snippet:
str = "Hello" str.upcase puts str str.upcase! puts strWhat is the error in this code?
str = "Hello" str.upcase puts str str.upcase! puts strWhat is the error in this code?
str.upcase callstr.upcase returns an uppercase string but does not change str itself unless assigned.str.upcase! callstr.upcase! modifies str in place, changing it to uppercase.upcase without assignment does not change str -> Option C15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions