Passing array to function

Hi,

Is there a way to pass an array to a function… e.g

myArray = Array.new( 5, “Hello” )

def bye( arr )
arr[2] = "Goodbye"
end

Couldn’t find a way to do this…

Cameron

Seems to work fine for me?

···


Justin Johnson.

“Cameron Matheson” cmatheson3@hotpop.com wrote in message
news:20020724062511.GA16425@hachi…

Hi,

Is there a way to pass an array to a function… e.g

myArray = Array.new( 5, “Hello” )

def bye( arr )
arr[2] = "Goodbye"
end

Couldn’t find a way to do this…

Cameron

Is there a way to pass an array to a function… e.g

myArray = Array.new( 5, “Hello” )

def bye( arr )
arr[2] = "Goodbye"
end

Perhaps I am misunderstanding something here, why won’t just:

   bye(myArray)

work? I just did that on irb, it returns “bye”, and changes the
array as you’d expect.

Hmm,

I guess i’m crazy and had a typo in my file w/ the src. Sorry everyone

Cam

···

On Wed, Jul 24, 2002 at 03:26:49PM +0900, Cameron Matheson wrote:

Hi,

Is there a way to pass an array to a function… e.g

myArray = Array.new( 5, “Hello” )

def bye( arr )
arr[2] = "Goodbye"
end

Couldn’t find a way to do this…

Cameron