[541] in Coldmud discussion meeting
Re: To-Do list..
daemon@ATHENA.MIT.EDU (Sun Nov 6 13:26:42 1994
)
From: frankc@netcom.com (Frank Crowell)
To: coldstuff@MIT.EDU
Date: Sun, 6 Nov 1994 10:26:08 -0800 (PST)
In-Reply-To: <199411042101.AA00504@crl4.crl.com> from "Alex Stewart" at Nov 4, 94 01:01:50 pm
>
> Up for Discussion
> -----------------
> Do-while syntax
> This is my earlier suggestion of adding an optional "do" component to the
> existing "while" syntax, such that the syntax becomes:
> [do <statement>] while (<expr>) <statement>
> As far as I can tell, we never came to a real consensus as to whether this
> would be a good thing for me to add or not, so I'm listing it here..
> Basically, this would allow for test-at-end loops, and test-in-middle for
> that matter, along the following lines:
> do
> x = x + 1; // Do our processing first,
> while (x < 3); // and then test at the end of the loop
>
> do {
> .call_this_method(); // do some prerequisite stuff
> x = object.foo();
> } while (x) { // if !x, break out of the loop,
> y = y + x; // otherwise do something with it
> .tell("yay!");
> } // and loop back up to the "do" point
>
> etc.. while still allowing the previous syntax of:
> while (foo) {
> .do_something_with(foo);
> }
>
> etc.
>
Yes. The form:
do { } while () { }
is actually a more complete form of:
do { } while();
and
while ( ) { }
--
[Frank Crowell frankc@netcom.COM]
[Home page ftp://ftp.netcom.com/pub/frankc/pages.html]