A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-26.go
1packagemain
2
3import"fmt"
4
5funcmain(){
6n:=0
7switchn{
8case0:
9fmt.Println("zero")
10fallthrough
11default:
12fmt.Println("other")
13}
14}
Iteration
Answer & explanation
Console output
zero
other
Why
case 0 matches n and prints "zero", then fallthrough transfers into the next case in source order, which happens to be default, printing "other". fallthrough ignores case conditions, so default executes despite a successful earlier match. Both lines print.