Answers for "golang loop through array"

C
3

loop list golang

a := []string{"Foo", "Bar"}
for i, s := range a {
    fmt.Println(i, s)
}
Posted by: Guest on April-11-2020
0

golang loop through array

arr := []int{1, 2, 3, 4, 5}
//using range 
for index, ele := range arr { // you can escape index by _ keyword
	fmt.Println(index, ele)
}
Posted by: Guest on September-07-2021

Code answers related to "C"

Browse Popular Code Answers by Language