> and while loops are much clearer in meaning.

That's a purely subjective point to make and, in my opinion, often =
untrue.

while !x.nil?
  // body
end

vs.

until x.nil?
  // body
end

is a simple example where I like the until version better. Once =
DeMorgan's
law kicks in for certain negations, until loops can become much cleaner. =
Example:

while !x.nil? || y < 0
  // body
end

until x.nil? && y >=3D 0
 // body
end

I personally think the until loop there is *much* simpler to read.

Michael Edgar
adgar / carboni.ca
http://carboni.ca/

On Mar 11, 2011, at 5:57 PM, 7stud -- wrote:

> Devin Rawlek wrote in post #986991:
>> Thank you Steve. That was exactly what I needed.
>>=20
>> This works perfectly.
>>=20
>> $Str =3D gets.chomp
>> $Str.to_i < 0
>=20
> What is that line for?  As written it does nothing: the comparison=20
> evaluates to either true or false and then the value is discarded.
>=20
>>  until $Str.to_i > 0
>=20
>=20
> Note that any until loop can be written as a while loop:
>=20
> while $Str.to_i <=3D 0
>=20
> and while loops are much clearer in meaning.
>=20
> --=20
> Posted via http://www.ruby-forum.com/.
>=20