Search
 
SCRIPT & CODE EXAMPLE
 

C

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)
}
Comment

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 %s
", i, data[i])
    }
}
Comment

Looping through an array in Go

package main
import "fmt"

func main() {
  age := [...]int{12, 4, 5}

  // loop through the array
  for i := 0; i < len(age); i++ {
    fmt.Println(age[i])
  }

}
Comment

PREVIOUS NEXT
Code Example
C :: how to print something out to the console c 
C :: vscode arduino [Warning] Output path is not specified. Unable to reuse previously compiled files. Upload could be slow. See README. 
C :: c get file size 
C :: transpose of matrix using c program 
C :: shuffle function in c 
C :: check if string starts with c 
C :: sdl draw Rectf 
C :: sdl_renderfillrect 
C :: data types in c 
C :: types of instruction and there meaning in c 
C :: sigaction in c 
C :: for loop c 
C :: write a program in c to check whether the number is armstrong or not 
C :: c program 
C :: c convert integer to string 
C :: copy string c 
C :: c binary search 
C :: sequelize count multiple associations 
C :: function for calculate the average and standard deviation of table 
C :: c char to lower case 
C :: what is string::npos 
C :: convert int to char in c 
C :: print variable adress c 
C :: bash get load average 
C :: how to malloc for matrix in c 
C :: how to change background color in c programming 
C :: transfer function exponent matlab 
C :: cifras de un numero en c 
C :: -42 c to f 
C :: working outside of application context 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =