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
Golang program for implementation of AVL Trees
How to use WaitGroup to delay execution of the main function until after all goroutines are complete.
How to Convert string to integer type in Go?
Web Application to Get Trending Hashtags Near a Location
How to check specific field exist in struct?
Expected <type>, but got <type> error in Golang