[430] in Coldmud discussion meeting

root meeting help first previous next next in chain last in chain last

"fixing" while loops

daemon@ATHENA.MIT.EDU (Thu Sep 22 13:55:25 1994 )

From: deforest@netcom.com (Robert de Forest)
To: coldstuff@MIT.EDU
Date: Thu, 22 Sep 1994 10:47:12 -0700 (PDT)

Problem:

a = .test();
while (a) {
  .do_something();
  a = .test();
}

Is nasty because it does the assignment identically in two sections and
 takes up more lines by far than

while (a = .test())
  .do_seomthing();

Proposed solution:

New statement with syntax of "while <var> test (expr) statement"

In the above it would look like:

while a test (.test())
  .do_something();

This makes a kind of loop that is like a for, but with more dynamic loop
 conditions. I think the meaning of this statement is completely in harmony
 with all the other statements' formats and all that.

I'd like something better than while test, thought....

Anybody like the idea, at least? :)

Crag / Robert de Forest