conventions.io

Tech Challenge

2026-08-08

🦫

Daily Tech Challenge

Go

medium
Question 1 of 5

What does this Go program print, given how fallthrough behaves in an expression switch?

Example
package main

import "fmt"

func classify(n int) string {
	s := ""
	switch {
	case n > 10:
		s += "big "
		fallthrough
	case n > 5:
		s += "medium "
		fallthrough
	case n > 100:
		s += "huge "
	default:
		s += "small"
	}
	return s
}

func main() {
	fmt.Printf("%q\n", classify(20))
}

Saturday, August 8, 2026 · A new challenge drops every day