why no "do : until"?

Bjorn Pettersen pbjorn at uswest.net
Wed Jan 3 13:24:34 EST 2001


Steve Lamb wrote:

> On Wed, 03 Jan 2001 14:45:29 GMT, Grant Edwards <grante at visi.com> wrote:
> > if (whatever) {
> >   do something;
> >   do something else;
> > } else {
> >   yet another thing;
> > }
>
> >I simply can't read read code like that, and generally do an
> >'indent -gnu' on it before I try to figure out what's going on...
>
>     I normally do a variation of this.
>
> if (whatever) {
>   do something;
>   do something else;
> }
> else {
>   yet another thing;
> }
>
>     This is so the ending brace is lined up with what it is ending.  The
> { else } in the middle of the K&R ruins that.  How does a } close a } !?!?!?
> In the one I write we see an if closed and an else closed.

So then you'd also write:

do {
    something;
}
while (condition);

to be consistent?  Seems ugly and inconsistent to me (the else isn't a statement,
it's part of the if ;-)

long-live-the-OTB'ly y'rs
-- bjorn





More information about the Python-list mailing list