|
|
Orchid XP v8 wrote:
> Darren New wrote:
>
>> The pendant in me wants to have an actual condition as the argument to
>> "while". :-) Or at least
>>
>> do {
>> ....
>> } while (number != target);
>
> Yeah - although that would require "number" to be declared outside the
> while loop so that it actually exists. ;-)
Yes, I think so.
> More subtly, it would have to
> be initialised to a value that is guaranteed to not equal "target". Ooo,
> *that* could be a nasty bug to try to find...!
No, because you're using a "do while" instead of just a "while". That
like "repeat until" in Pascal (except with a reversed boolean, of course).
And yes, you'd have to initialize the value, but that's all high-school
programming type stuff. Probably the compiler at this point would warn
you the variable isn't initialized.
--
Darren New / San Diego, CA, USA (PST)
Post a reply to this message
|
|