On Feb 7, 2005, at 8:20 AM, Sam Goldman wrote:

> String#to_i doesn't mutate the string.
>
> Chris Gehlker wrote:
>> I'm just curious. I already found a work-around.
>> testAry = ["5", "7", "9"]
>> p testAry
>> testAry = testAry.each { |n| n.to_i}
>> p testAry
>> ------------------------------
>> The second output is still an array of strings.

Sam and Zach,

I get your points. My question was how come the assignment back to 
testAry doesn't replace it with an array of numbers. Here is a 
different version of the program which may highlight the problem.

testAry = ["5", "7", "9"]
p testAry
numAry = testAry.each { |n| n.to_i}
p numAry

---
If you came and you found a strange man... teaching your kids to punch 
each other, or trying to sell them all kinds of products, you'd kick 
him right out of the house, but here you are; you come in and the TV is 
on, and you don't think twice about it.
-Jerome Singer