Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
out and back to loop
Hi everyone, I don't understand how out from a loop while. I have a test loop ho test the contacts GPIO from my raspberry then the contact go to close send email (just one) and when the contact go back to open sand one email (just one) to say what he is open. Meanwhile the test loop continues. now it's worked but he sends as much mail as loop turns. somone can give me idea to solvd thet ? thank you.
To get out of a loop, you use the break statement:

num = 1
while True:
    num += num
    if num > 100:
Craig "Ichabod" O'Brien -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
ok but how I go back to my loop ?

Possibly Related Threads…
Thread Author Replies Views Last Post
  Loop back through loop based on user input, keeping previous changes loop made? hbkpancakes 2 136 Nov-21-2020, 02:35 AM
Last Post: hbkpancakes
  How to make loop go back to the beginning if test evaluaes to True. FWendeburg 1 850 Feb-13-2019, 01:26 AM
Last Post: stullis

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020