高朗游#23

I am going through the go tour, and I am unsure of the error I am making with question #23 that is causing the process to take too long. http://tour.golang.org/#23

package main

import (
    "fmt"
    "math"
)

func Sqrt(x float64) float64 {
    guess := 1.0
    i := 1
    for i < 10 {
        guess = guess - (math.Pow(guess, 2)-x)/(2*guess)
    }
    return guess
}

func main() {
    fmt.Println(Sqrt(2))
}

I get the error: [process took too long]

You're not incrementing the i variable in your loop, so it's always < 10.

 //-----------v
for ; i < 10; i++ {
    guess = guess - (math.Pow(guess, 2)-x)/(2*guess)
}