There is no While loop in Go, but you can use For loop as while loop:
i := 1
for i < 100 {
fmt.Println(i)
i += 1
}
func main() {
var myTxt = "This is a sentence"
for index, letter := range myTxt {
fmt.Println("Index:", index, "Letter: ", string(letter))
}
}
标签:index,myTxt,fmt,While,Go,using,loop From: https://www.cnblogs.com/Answer1215/p/16655370.html