# Upcase array

**URL:** <https://rubytalk.org/t/upcase-array/13989>\
**Category:** ruby-talk\
**Created:** [6 October 2004 09:28 UTC](https://rubytalk.org/t/upcase-array/13989 "2004-10-06T09:28:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_Pena\_Botp1](https://avatars.discourse-cdn.com/v4/letter/_/94ad74/32.png) [@\_Pena\_Botp1](https://rubytalk.org/u/_Pena_Botp1)\
**Post date:** [6 October 2004 09:28 UTC](https://rubytalk.org/t/upcase-array/13989/1 "2004-10-06T09:28:33Z")

</div>

> \> Given this array:  
> \> foo = %w { FOO BAR baz biz }  
> \>  
> \> How do I make all the entries uppercase in a short and readable way?  
> \>  
> \> The (to me) obvious solution won't work:  
> \> foo.map! { |x| x.upcase! }  
> \> as upcase returns nil if it doesn't have anything to upcase...  
> \> //F

try,  
irb(main):004:0\> foo.each{|x| x.upcase!}  
=\> ["FOO", "BAR", "BAZ", "BIZ"]

> Thomas

kind regards -botp

> **···**
>
> Fredrik Jagenheim \<jagenheim@gmail.com\> wrote:
