Switch
A switch statement is a cleaner alternative to a long chain of if-else blocks. It runs the first case that matches — and only that case.
Here’s the big difference from C, Java, or JavaScript: Go does not fall through by default. No need to write break at the end of every case — Go adds it automatically.
Two more things worth knowing: switch cases don’t have to be constants, and the values don’t have to be integers. Go is more flexible here than most languages.