Thank you for the explanation for it. I must tell you that i yust beginning with python. I bought the book beginning programming with python.
In reply to "Dennis Lee Bieber" who wrote the following: > On Mon, 02 Nov 2015 13:29:04 GMT, input/ldompel...@casema.nl declaimed the > following: > > > I tried to use def loop(): now for to restart the script. > > but its only restart "fwd()" print ("forward 1x") and then stop. > > > def loop(): > > fwd() > > print ("forward 1x") > > time.sleep(2) > > stop() > > > > if mindist > us_dist(15): > > Which is exactly what you told it to do. You have defined a function > containing four statements: fwd(), print(), sleep(), and stop(); after > executing the stop the function will return to where it was called -- the > end of your program. > > All of your"if" statements will be executed after "loop" is defined > (but not executed) and before the call to "loop" at the bottom. They are > NOT part of "loop". Please reread the Python language reference manual, > focusing on the part that describes indentation and block structuring. > > > > loop() > > > > Also, just calling something "loop" does not make it a loop. This > function will be called just one time and then the program will exit. > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.com HTTP://wlfraed.home.netcom.com/ -- --------------------------------- --- -- - Posted with NewsLeecher v7.0 Beta 2 Web @ http://www.newsleecher.com/?usenet ------------------- ----- ---- -- - -- https://mail.python.org/mailman/listinfo/python-list