How To Exit Out Of Loop


#1

I’ve been trying to create a nag message for both my dryer and washer so that when it stops, reminders will be sent using a while loop. When the dryer or washer stops a nag message is sent correctly every 10 minutes for the 1st hours and then every hour after that.

The issue I’m having is that I want the nag message and the while loop to stop when the dryer or washer door opens, but I’m not having any luck with the proper code. The nag message the while loop just keeps going even if the dryer or washer door opened.


#2

Use the break statement.


#3

Thanks @ady624. I added the break at then end of the while loop, but is that correct as I only see restriction for the break.

While…
.
.
.
Break
End While


#4

You need to add an IF inside the while and use the Break inside it?


#5

Ok, I moved the While on line 72 outside the If on line 66 and then moved that same If within the while with a break at the end.

While…
.
.
.
If…
Break
EndIf
End While


#6

Still having trouble with the break. Can you tell what I’m doing wrong. I tried placing the IF inside the WHILE with a break inside the IF, but no luck. Also tried with the messages inside the WHILE and inside the IFTHEN, but no success yet.

1)When the dryer stops send a reminder after 10 minutes if the door remains closed
2)Keep sending messages
3)Break out of the loop when the dryer door opens.


#7

@twodaend, not sure if you ended up with a solution for this, but if not, read on. I am completely new to coding and I am trying to figure things out by looking at examples of what others have done - so if I am comletely off base here, excuse my ignorance.

I found this thread while trying to figure out how Loops work, and what values to put into the fields. Although I haven’t figured that out yet for another piston I have, I thought I would share with you the 2 rules I am using for achieving a nag message for the washing/drying.

Rule 1 of 2

Rule 2 of 2

They are working really well. Hope this helps, but if not, excuse my ignorance.