| Store | Cart

No, loop-and-a-half! (Re: REPEAT... UNTIL ?)

From: Rich Harkins <r...@worldsinfinite.com>
Fri, 12 Jul 2002 09:52:06 -0400
> I like that kind of syntax. I'd like to propose an alternative> keyword:>>   while cond1:>     dofoo()>   andwhile cond2:>     dobar()>

So does this eqate to the following in current python?

while cond1:
	dofoo()
	if cond2:
		dobar()

or?

while cond1:
	dofoo()
	if cond2:
		dobar()
	else:
		break

> with an analogous structure:>>   if cond1:>     dofoo()>   andif cond2:>     dobar()>   else:>     doqux()>

and this?

if cond1:
	dofoo()
	if cond2:
		dobar()
else:
	doqux()

or?

if cond1:
	dofoo()
	if cond2:
		dobar()
	else:
		doqux()
else:
	doqux()

> where foo is done if cond1, bar is done if (cond1 and cond2) and qux> is done if not (cond1 and cond2). For consistency with elif it could> be called anif instead?

What if I get more complicated:

if cond1:
	true1()
andif cond2:
	true2()
elif cond3:
	true3()
andif cond4:
	true4()
else:
	false()

How does this translate to current Python?  (I'm gettting a headache now)

I think I like Python's explicit nature better than these cases (as well as 
the all of the messages in this thread).  I don't have to guess how Python 
will process my instructions nor do I have to think very hard about what a 
program will do when reading it.

Rich

Recent Messages in this Thread
Rich Harkins Jul 12, 2002 01:52 pm
Andrew Clover Jul 15, 2002 09:47 am
Alexis Layton Jul 12, 2002 02:43 am
Andrew Clover Jul 12, 2002 09:47 am
Paul Svensson Jul 14, 2002 09:36 am
Messages in this thread