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 find Name Server (NS) record of a domain
How to convert Struct fields into Map String?
5 Must-Know Blockchain Trends for 2024 and Beyond
Example to use various String Functions in Go Language
How to Convert string to integer type in Go?
Golang program for implementation of Selection Sort