DEV Community

Discussion on: An if else alternative

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited
  • This also works in Python, where there is no switch case. Also switch case has a problem from fall through. This is solved in Kotlin.
  • Cautions are
    • Store function handler itself, not the result
      • Be careful of pre-choice computations
Collapse
 
miteshkamat27 profile image
Mitesh Kamat

Thanks for your feedback. I haven't worked on python yet and the cautions that you mentioned are worth considering.