Here's a hint. Rather than looping through the array as is and trying to pic=
k out the min and max, why not sort the array into ascending order and print=
 the first and last members of it?

<!--
Sincerely,
Thomas Murphy
646.957.6115
-->

> On Nov 29, 2013, at 7:25 PM, Adam Tonto <lists / ruby-forum.com> wrote:
>=20
> I'm not looking for anyone to GIVE ME the answer/ do homework for me.
> I'm just looking for a turn in the right direction. Here is my code:
>=20
> ________________________________________________________________________
>=20
> array =3D [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
> min =3D 0
> max =3D 0
> x =3D 0
> i =3D array.length - 1
>=20
> while x < array.length - 1
>  if array[x] > array[x - 1]
>    max =3D x
>  end
>  x+=3D1
> end
>=20
> while i > 0 array.length - 1
>  if array[i] < array[i + 1]
>    min =3D i
>  i-=3D1
>  end
> end
>=20
> puts "Min is: #{min}."
> puts "Max is: #{max}."
>=20
> ________________________________________________________________________
>=20
> --=20
> Posted via http://www.ruby-forum.com/.