While Loop; only running once

openhab 2.5.10

Why does this while loop only run once?

var Number GarageTxtCounter = 1
				while(GarageTxtCounter < 10){
					mailActions.sendMail("1111111111@vtext.com", "GarageTilt Door Open", "GarageTilt Door Open")
					GarageTxtCounter = GarageTxtCounter + 1
				}

Tried this too, same result; only runs once

				var GarageTxtCounter = 1
			while((GarageTxtCounter=GarageTxtCounter+1) < 11){
				mailActions.sendMail("1111111111@vtext.com", "GarageTilt Door Open", "GarageTilt Door Open")
				GarageTxtCounter = GarageTxtCounter + 1
				Thread::sleep(3000)
			}

Did you define mailActions?

val mailActions = getActions("mail","mail:smtp:989680e0")

I’m on OH3 so I cant test it for you. Also, check your logfiles, there should be some more information about why the rule failed.

Yeah, mail actions is definitely defined. It runs one time.
I don’t see anything in the log as to why it only runs once.
I did figure it out, the lead in to that splice of code was a switch
If (switch == ON)
It didn’t run because it needed .state
if (switch.state ==ON)