From: Michael Gorsuch Date: 2006-05-15T08:36:04+09:00 Subject: Re: begining programmer questions ------=_Part_28857_26756982.1147649761629 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 'gets' will read a string from input and build a new string object. When you did 'info =3D gets.chomp', you wiped out your array and made it a simple String object. 'exit' is being stored because your program logic is placing the string int= o the Array, and then checking to see if the last retrieved value is 'exit'. You may be better off using a temporary variable first, checking it, and then storing it. On 5/14/06, corey konrad <0011@hush.com> wrote: > > oh ok basicly the issue is that i just didnt understand what the gets > method was doing, it was creating another string? Wow i thought it just > GOT another string i didnt know it created one. Thats really confusing. > Puts and Gets have been really confusing methods for me so far. > > also why does puts #{info} always print exit even if a user doesnt type > that in, that doesnt make sense to me at all. > > > > Michael Gorsuch wrote: > > Ah! > > > > Take a look here: > > > > "info =3D gets.chomp" > > You've just changed 'info' into a String. > > > > Instead, do this: > > > > "info << gets.chomp" > > > > This means 'get some stuff, chomp it, and add it to the info Array' > > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_28857_26756982.1147649761629--