Skip to content

Instantly share code, notes, and snippets.

@jreisinger
Created July 28, 2017 21:30
Show Gist options
  • Save jreisinger/ed2b5a8b1df2fadc1f1c78fc31c7c05f to your computer and use it in GitHub Desktop.
Save jreisinger/ed2b5a8b1df2fadc1f1c78fc31c7c05f to your computer and use it in GitHub Desktop.
package main
import "fmt"
func main() {
// array of 5 elements
x := [5]float64{98, 93, 77, 82, 83}
var total float64 = 0
// we don't need array index -> _
for _, value := range x {
total += value
}
fmt.Println(total / float64(len(x)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment