index work

This commit is contained in:
Mark McGranaghan 2012-09-23 14:33:49 -07:00
parent 64aa4acf05
commit 3474d39dc5
129 changed files with 2 additions and 58 deletions

View File

@ -1,16 +0,0 @@
// ## Mutation
package main
import "fmt"
func main() {
var x string
x = "old"
fmt.Println(x)
// You can mutate variables in Go by re-assigning the
// variable to a new value.
x = "new"
fmt.Println(x)
}

View File

@ -1,3 +0,0 @@
$ go run mutation.go
old
new

View File

@ -1,20 +0,0 @@
// ## Sum
package main
import "fmt"
func main() {
var x [5]float64
x[0] = 98
x[1] = 93
x[2] = 77
x[3] = 82
x[4] = 83
var total float64 = 0
for i := 0; i < 5; i++ {
total += x[i]
}
fmt.Println(total / float64(len(x)))
}

View File

@ -1,14 +0,0 @@
// ## Floats
package main
import "fmt"
func main() {
x := [5]float64{ 98, 93, 77, 82, 83 }
total := 0.0
for _, v := range x {
total += v
}
fmt.Println(total / float64(len(x)))
}

Some files were not shown because too many files have changed in this diff Show More