vendredi 17 août 2018

nested if condition and break

All,

I have a code that looks like this:

if condition

  if condition: 
     do something
  elif condition:
     do something
  else:
     break
else: 
  do something

I have a nested if condition and I introduced a break in the inner "if condition" with the intention to break from the inner loop if inner conditions are not met and move on to the "else" of the outer loop.

In your opinion, does it make sense to do that way? is there a simple way of writing the problem.

Aucun commentaire:

Enregistrer un commentaire