Go Slices: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:
<font color=red>'''TODO''' Deep difference between slice and array (memory model, etc.)</font>
<font color=red>'''TODO''' Deep difference between slice and array (memory model, etc.)</font>


=Declaration=
A slice declaration is similar to an array's except the length is not specified.
<pre>
var s []int
</pre>


=Slice Literals=
=Slice Literals=

Revision as of 23:15, 27 March 2016

Internal

Overview

A slice is a reference type that implements a dynamic array. Slices are indexable, and they have a variable length.

TODO Deep difference between slice and array (memory model, etc.)

Declaration

A slice declaration is similar to an array's except the length is not specified.

var s []int

Slice Literals

Slice Operators and Functions

Slice built-in functions append(), copy().