if条件语句
if {
do some thing....
}else if{
do some thing....
}else{
do some thing....
}
for 循环
for i := 0; i < 10; i++ {
fmt.Println(i)
}
var i = 0
for ; i < 10; i++ {
fmt.Println(i)
}
i = 0
for i < 10 {
fmt.Print(i)
i++
}
//遍历key和value的情况
for key, value := range "lvhuxu" {
fmt.Printf("%d %c\n", key, value)
}
//只用一个则为数字下标key
for key := range "lvhuxu" {
fmt.Printf("%d\n", key)
}
//只需要遍历值的情况
for _, value := range "lvhuxu" {
fmt.Printf("%c\n", value)
}