------art_28557_10695513.1147646226195
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

while info[] != "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 = []
  while (data = gets.chomp) != '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 = []
>   info << gets.chomp
> while info[] != "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 = []
> >>
> >> You can build a Hash via:
> >>
> >> info = {}
>
>
> --
> Posted via http://www.ruby-forum.com/.
>
>

------art_28557_10695513.1147646226195--