Skip to content

Instantly share code, notes, and snippets.

@chanwit
Created June 9, 2011 07:18
Show Gist options
  • Select an option

  • Save chanwit/1016248 to your computer and use it in GitHub Desktop.

Select an option

Save chanwit/1016248 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func sum(x []int) int {
s := 0
for _,i := range x {
s += i
}
return s
}
func main() {
abc := []int{0,20,30}
abc[0] = 10
fmt.Printf("%d\n", sum(abc))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment