I have some problems getting a couple of elements working right… I
have 2 small issues:
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??
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.
On Wed, Dec 14, 2011 at 3:42 AM, matha wasint [email protected]
wrote:
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??
What exactly is your problem?
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.