In my recent post I questioned the use of a switch instead of an if else statement. This gave me the idea of an recurring item for dev.to: Commit or Vomit! Would you commit this code or not.
It's going to be code snippets that are going to be evaluated here. Not posts because I don't want people to feel/be judged by this, only code!
So this first β||π€’ is from the post that started it all.
If (all) else is complicated, switch to switch?
π€π₯ Jasper de Jager γ» Apr 1 γ» 1 min read
switch(true){
case userMissedAppointment:
return 'nope';
case userHasAngularExperience:
case userHasReactExperience:
case userHasVueExperience && userCanStartInstantly:
return 'hire';
default:
return 'maybe'
}
This is just an example but the question is about the switch(true). What do you think? β||π€’
β€: Commit
π·: Vomit (we all know unicorns don't vomit)
π¦: Like your post please continue this series!
Looking forward to your reactions! π