POV-Ray : Newsgroups : povray.off-topic : My first C++ program : Re: A test Server Time
4 Nov 2024 19:24:12 EST (-0500)
  Re: A test  
From: Darren New
Date: 21 Sep 2008 10:39:10
Message: <48d65c8e@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.