lundi 6 septembre 2021

how to shift from else loop to if loop python? [closed]

How to shift from else loop to if loop .I have attached a code for better explanation

while 1:    
    if img1 appears on screen:
       # do some task(it includes multiple if statements in it too)
    else:
       #do task 1
       #do task 2
       #do task 3

I want as soon as image1 appears on screen else loop should exit(shift from else to if) even if it's incomplete.like if image1 appears when else loop is doing task 2 it should exit without completing it and move to the if loop. with my current code if image1 appears on screen the else loop only exits when all 3 tasks are done. I want to exit the else loop not the if loop and by exit or break I mean shift from else loop to if loop

Aucun commentaire:

Enregistrer un commentaire