From: Michael Gorsuch Date: 2006-05-15T07:37:11+09:00 Subject: Re: begining programmer questions ------=_Part_28557_10695513.1147646226195 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline while info[] !=3D "exit" this line is giving the error. The '[]' piece expects an integer to placed in there to reference the array. For example, info[0] or info[53]. I suggest something similar to this: def input puts "Enter some info" info =3D [] while (data =3D gets.chomp) !=3D 'exit' info << data end info.sort! puts info end On 5/14/06, corey konrad <0011@hush.com> wrote: > > well i tried what you said but i still get an error now, it says that i > have the wrong number of arguments. I know it isnt that important of > program but i just dont understand the error messages. > > def input > puts "Enter some info" > info =3D [] > info << gets.chomp > while info[] !=3D "exit" > info << gets.chomp > end > info.sort > puts "#{info}" > end > > > > corey konrad wrote: > > ok thanks for the help > > > > > > > > Michael Gorsuch wrote: > >> I suppose it could, but I think the easiest way to build an Array in > >> ruby is > >> as follows: > >> > >> info =3D [] > >> > >> You can build a Hash via: > >> > >> info =3D {} > > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_28557_10695513.1147646226195--