mercredi 13 mai 2020

Python order of multiple elif statements

Does the order of multiple "elif" statements matter in python, specifically in string checking

for example:

if 'foo' in line:
  #do something
elif 'bar' in line:
  #do other thing
elif 'coffe' in line:
  #do other other thing
...
else:
  #something something

Aucun commentaire:

Enregistrer un commentaire