// slices are a dynamically sized, flexible
// view of the array. []T represents a slice,
// whereas [n]T represents an array.

package main

import "fmt"

func main() {
    primes := [6]int{2, 3, 5, 7, 11, 13}
    fmt.Println(primes)

    // declare a slice
    var s []int = primes[1:4]
    fmt.Printf("Type: %T Value: %v\n", s, s)

    // or just omit the type
    p := primes[2:5]
    fmt.Println(p)

    p[0] = 17
    fmt.Println(primes)
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: