I have no idea

Remco Gerlich scarblac at pino.selwerd.nl
Mon Mar 12 08:06:37 EST 2001


Brendhan Horne <brendhanhorne at bellsouth.net> wrote in comp.lang.python:
> In basic you use to be able to do this:
> 10 print "Hello World"
> 20 goto 10
> Run
> 
> If you did that it would run up the screen in an endless loop until you hit
> the ESC key. If you added   ; it would cover the whole screen. How do you
> write the equivalent in python?

while 1:
   print "Hello world"

There is no "goto" in Python, people noticed a long time ago that that
statement can lead to very confusing code, and that it is not necessary.

Instead of 'while 1:', you can also say 'while "true":' or something else
that will stay true forever.

The equivalent of adding a ; is adding a ,.

while 1:
   print "Hello world",

-- 
Remco Gerlich



More information about the Python-list mailing list