I have this long list of conditions inside a function:
if x == "a":
return function_a()
elif "b" in x:
return function_b()
elif x == "c string":
return function_c()
elif x == "d string":
return function_d()
else:
function_e()
How can I simplify this so that I can reduce the cognitive complexity of my function?
Aucun commentaire:
Enregistrer un commentaire