Skip to content

Instantly share code, notes, and snippets.

@dineshsprabu
Created April 26, 2017 06:33
Show Gist options
  • Save dineshsprabu/52a6d4faad6fc91d05218af99d849d25 to your computer and use it in GitHub Desktop.
Save dineshsprabu/52a6d4faad6fc91d05218af99d849d25 to your computer and use it in GitHub Desktop.
[Golang] Using range in Golang

Golang 'range' method returns 2 values (index, value)

package main

import (
"fmt"
)

func main(){
	ranks := []int{3,4,5,6}
	for index, value := range ranks{
		fmt.Println(index, value)
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment