continue loop without iteration...

Roman Suzi rnd at onego.ru
Fri Jun 1 12:59:26 CEST 2001


On 1 Jun 2001 kasper37 at caffeinedreams.com wrote:

> basically, this is what I need to do:
> 
> x=1
> y=x
> 
> while x <= y:
>     if something:
>         x=x+1
>         y=y+1
>         continue
>     dosomething
>     x=x+1

x = y = 1

while x <= y:
    if something:
        y=y+1
    else:
        dosomething
    x=x+1

is much clearer, IMHO. 
 
> therefore, if the if statement is always true, it should never end,
> but as soon as it's false, dosomething will happen and it will stop.
> 
> Dan


Sincerely yours, Roman A.Suzi
-- 
 - Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
 





More information about the Python-list mailing list