ruby - What doesn't e.upcase return upper case words -


I wanted to make an upper case case but this behavior was received:

  = & Gt; ["This", "set", "of", "word", "is", "in", "one", "fixed", "order"]   

for it : % w [This set of words is in a certain order] .each {| E E-upcas}

Why was the words not placed in the upper position?

(When I solve this problem, ignoring the actual order and dossing words right now).

Returns a new string value, it does not modify the receiver to achieve its desired behavior Use map to create a new array of advanced values, or for advanced values.

 % w [This set of words is in a fixed order] .each {| E E.upcase! } Up_words =% w [This set of words is in a certain order] .map (and: upcases)    

Comments