Slice of Slices in Golang
In the Go language, a Slice is a key data type that is powerful and flexible as compared to an array. Slice is an abstraction over an array and overcomes limitations of arrays like getting a size dynamically or creating a sub-array of its own and hence much more convenient to use than traditional arrays. It is just like an array, having an index value and length, but the size of the slice is resized they are not in fixed-size just like an array. Slices only store elements of the same type, different types of elements cannot be stored in the same slice.
A slice is formed by specifying two indices, a low and high bound, separated by a colon as illustrated below:
arr[low_bound : high_bound]
This includes the low_bound, but excludes the high_bound, where the smallest value of low_bound can be 0 and largest value of high_bound can be the length of arr array.
To make a slice of slices, we can compose them into multi-dimensional data structures similar to that of 2D arrays. This is done by using a function called make() which creates an empty slice with a non-zero length. This is shown in the following example:
[0 0 0] [0 1 2] [0 2 4] Slice of slices: [[0 0 0] [0 1 2] [0 2 4]]
It is possible to have a variable slice of slices due to their dynamic nature. This is shown in the example below:
 [1 2 3] [1 3 5 7 9] Slice of slices: [ [1 2 3] [1 3 5 7 9]]