Re: [Rails] Re: Good Ruubyist way
On Fri, May 24, 2013 at 10:33 AM, Paul Julian <bpj101@gmail.com> wrote:
> a = [1,2,3,4,5,6,7,8,9,10]
> b= a.reverse.reverse
Can't tell if you are trolling or if you think that's actually a good
idea. How about just doing:
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
b = a.dup
>
> On Friday, May 24, 2013 9:56:39 AM UTC-4, Ruby-Forum.com User wrote:
>>
>> a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>> b = a + [nil]
>> p a #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>> p b #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, nil]
>>
>> Is there any other Rubyist way to get the `b` array from `a` array?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAM5XQnx9wiM_odgT51wTmc-211tCLwpkK3NxFYAAg_Ao2cMxpQ%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home