← Back to archive

Stdle #144 · classes · 2026-10-28

What does this Go snippet output?

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

package main
import "fmt"
type Stack struct{ data []int }
func main() {
var s Stack
s.data = append(s.data, 1, 2)
fmt.Println(s.data, len(s.data))
}
Classes
4 attempts left

Answer & explanation