How to access slice items in Golang?
You access the slice items by referring to the index number.
Example
package main
import "fmt"
func main() {
var intSlice = []int{10, 20, 30, 40}
fmt.Println(intSlice[0])
fmt.Println(intSlice[1])
fmt.Println(intSlice[0:4])
}
Most Helpful This Week
GO Program to Check Armstrong Number
Top Programming Languages Behind Blockchain App Development
Interfaces with similar methods in Go Programming Language
How do you set cookies in an HTTP request with an HTTP client in Go?
Golang program for implementation of Comb Sort
GO Program to Check Whether a Number is Even or Odd