Skip to content

Posts tagged ‘switch statements’

Six Benefits I Got From Making My Switch Statement Playfuller

December 20th, 2020


While I was working on the new «welcome thingy» for new customers in our GatsbyJS app, I asked myself:

«Self, how do I make my switch statement playfuller?»

Because to better remember new JavaScript things I learn, I try to practice in a playfuller way every day 😺.

But before I tell you The Long Story I will jump straight to the benefits to my family and our indie hacked GatsbyJS app from using this excellent tip from the great and powerful Josh W. Comeau. 

Six Benefits For My Family From Making My Switch Statement Playfuller

  1. I got to draw parrots 🦜 and
  2. I got to ask Lillian (5.5 🦄 ) to colour those parrots with her new colouring pens. Why parrots? Look further below 🔽 in the The Long Story.
  3. It saved me programming work. Less code = less bugs 🐛 🦋🐌 🐜 🐝 🦗 🕷️ 🕸️ at least for me 😺
  4. It saved my boss programming work. 😺
  5. The final switch statement made my variable safe from bleeding outside of her snug little case. Better safe than sorry, as my father Captain Vea said.
  6. (Coming soon. This blog-post is still just a draft.)

Send Me YOUR Playfuller Practice Tip

I always look for one more way to practice playfuller, mail me your tip for playfuller programming practice ola 🐘

Ok, let’s go! I are now entering the start of The Long Story.

A long time ago, on a bridge
far, far away ….

DevOla took his first sip of dark coffee and opened issue #182 in the pow-app repo on github. Then he opened the Welcome.js file in VS Code and after ONE look he played with this idea:

I will make my switch statement 🦄 unicorny better by wrapping each case with {}

I will make my switch statement unicorny 🦄 better by wrapping each case with {} or squgglies as Josh W. Comeau calls them. But where I come from we say squigglies are hungry twin parrots squaking  «Mine! Mine!» like the gulls in Nemo. 🐠

Hungry Twin Parrots = squigglies as @JoshWComeau calls {}