+ 1

Can someone help me with this ruby code.

It keeps on telling me that "undefined method 'upcase' for ["med", "sof"]: Array" But rather accept reverse order. arr = ["med", "sof"] test = arr.upcase print test

13th Apr 2017, 9:24 PM
Safianu Mohammed
Safianu Mohammed - avatar
2 Answers
+ 8
@merkrafter has the right code, keep in mind that if you want to upper case a specific value you need to specify the array value or if you want the whole array to be upper cased then you might need to iterate through each values.
14th Apr 2017, 1:21 AM
MrCoder
MrCoder - avatar
+ 2
There is no upcase method defined for arrays. Try to use it for every entry of your array like: arr = [...] for x in arr x.upcase! end print arr
13th Apr 2017, 10:24 PM
merkrafter