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