Skip to main content
← Back to Code Arena
Easy Rookie SpeedRun slices make append

Go: Slice len and cap After Append

+100 XP · 5 min · attempt 1

Problem

What does the following Go snippet print? Enter the output exactly, including the single space between numbers.

    s := make([]int, 0, 4)
    s = append(s, 1, 2, 3)
    fmt.Println(len(s), cap(s))

Starter

// make([]int, length, capacity)
// append fills length up to capacity before reallocating.

Your answer

Log in to submit