From: Jim Weirich Date: 2006-05-16T03:09:54+09:00 Subject: Re: begining programmer questions Regg wrote: > I'm a newbie to Ruby, but not to programming. > > But the follow statement made by "Michael Gorsuch" is confusing. > > "When you did 'info = gets.chomp', you wiped out your array and made it > a > simple String object." > > I thought that Ruby was a strong typed language. > How can it change an Array to a String...I would have expected an error > to be produced in this instance. > > I would have hoped that once a type has been established for an object, > the object would only adhere to the rules of that object...not change > itself into a new object type. Names and Objects! When you do "info = gets.chomp", you are saying "take the object returned from gets.chomp and associate it with the name 'info'. Thereafter, anytime you use the name 'info', you are refering to the object associated with info. The original array object wasn't really wiped out. It still exists, and if another name is associated with it, you can still use it. However, the name 'info' no longer refers to it. -- Jim Weirich -- Posted via http://www.ruby-forum.com/.