cap vs len of slice in golang : <p>What is the difference between cap and len of a slice in golang?</p>

<p>According to definition:</p>

<p>A slice has both a length and a capacity.</p>

<p>The length of a slice is the number of elements it contains.</p>

<p>The capacity of a slice is the number of elements in the underlying array, counting from the first element in the slice.</p>

<pre><code>x := make([]int, 0, 5) // len(b)=0, cap(b)=5
</code></pre>

<p>Does the len mean non null values only?</p>
