Greetings:
I have some problems getting a couple of elements working right... I
have 2 small issues:
1. Trying to remove the first and last element in an array in Ruby:
def remove_ends(a)
a.pop
a.shift
end
I need out put like:
Input array: [1,2,3,4]
Output: [2,3]
This seems like I'm stumbling on how to reference the array that is
being processed rather than the original??
2. I'm trying to interleave 2 arrays. I've seen some examples online but
I need to keep the arguments (a,b) and other examples don't have 2
inputs.
I'm pretty close:
a.zip(b)
join
It interleaves just fine.. but I need the output to be 1 string:
"a1b2c3d4" I'm not sure how to get to the array created to use JOIN.
Thanks
Attachments:
http://www.ruby-forum.com/attachment/6839/valkyriecode.txt
--
Posted via http://www.ruby-forum.com/.