Mar-15-2023, 04:21 PM
(This post was last modified: Mar-15-2023, 04:21 PM by deanhystad.)
As Gribouillis says, because of your indentation you are doing while..else, not if..else.
while..else is hardly ever used. I see occasionally see for..else used in a program, but I cannot remember the ever seeing while..else. When using "else" in conjunction with a loop, the else code runs only if the loop terminated normally, based on the condition. If the look was terminated by a break, the else block does not run.
while..else is hardly ever used. I see occasionally see for..else used in a program, but I cannot remember the ever seeing while..else. When using "else" in conjunction with a loop, the else code runs only if the loop terminated normally, based on the condition. If the look was terminated by a break, the else block does not run.
i = 1 while i < 5: i += 1 else: print("while terminated normally") i = 1 while True: i += 1 if i > 4: print("break out of while loop") break else: print("while terminated normally")
Output:while terminated normally
break out of while loop
Your code never prints "No Trigger" because the loop never ends.