Answers for "adding elements to an array in golang loops"

Go
0

go Iterating over an array in Golang

package main

import "fmt"

func main() {
    data := [...]string{"Ned", "Edd", "Jon", "Jeor", "Jorah"}
    for i := 0; i < len(data); i++ { //looping from 0 to the length of the array
        fmt.Printf("%d th element of data is %sn", i, data[i])
    }
}
Posted by: Guest on October-18-2021

Code answers related to "adding elements to an array in golang loops"

Browse Popular Code Answers by Language