dimanche 15 août 2021

How to break a condition statement and go to elif/else once reached inside the condition block?

I have if/elif/else in my code, however, I figured out that there is a time my code goes through elif statement but by the end of elif block I realized that my inputs are not being applied to the code inside. So that means I needed to check the next elif/else. Is there a way I can break the current "condition" block and consider it as if it was not visited?

I won't be able to share my code but I can try to give you an example:

group = [A,B,C]

if condition:
   pass

elif len(group) >=3 :
    for each in group:
        if not processed(each):
            process(each)
else:
    do something else

There is a lot going through the if block, but there is a time everything in the group is processed, and I would like to still visit else if that happens as if I never went through elif block.

Aucun commentaire:

Enregistrer un commentaire