← Back to archive

Stdle #120 · classes · 2026-10-04

What does this Go snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

package main
import "fmt"
type C struct{ V int }
func (c C) Inc() { c.V++ }
func main() {
c := C{V: 10}
c.Inc()
fmt.Println(c.V)
}
Classes
4 attempts left

Answer & explanation