jeudi 2 avril 2015

Python Nested Conditional Expressions as C++ does [duplicate]


This question already has an answer here:




Is there something in Python similar to the C++ switch operator?



switch (letters) {
case 'A': doActionA
case 'B': doActionB
case 'C': doActionB
...
default: doDefaultAction
}


Something that can help you to avoid deep if-else nesting and to maintain a flat and linear conditional structure.


Aucun commentaire:

Enregistrer un commentaire