for循環(huán)的三種方式:
for i := 1; i < 10; i++ {
//....
}
for {
//....
}
for k, v := range a {
//....
}
for _, v := range a {
//....
}
for i := 1; i < 10; i++ {
//....
}
for {
//....
}
for k, v := range a {
//....
}
for _, v := range a {
//....
}
2018-04-17
類型斷言
var a interface{}
a = 3.14
switch a.(type) {
case int:
case float64:
case bool:
case string:
default:
}
var a interface{}
a = 3.14
switch a.(type) {
case int:
case float64:
case bool:
case string:
default:
}
2018-04-17
switch exp {
case v1:
case v2:
case v3:
default:
}
case v1:
case v2:
case v3:
default:
}
2018-04-17
iota常見(jiàn)使用法:
1,跳值適用法;
2,插隊(duì)使用法;
3,表達(dá)式隱式使用法;
4,單行使用法。
1,跳值適用法;
2,插隊(duì)使用法;
3,表達(dá)式隱式使用法;
4,單行使用法。
2018-04-16
const (
cat string = "奧迪"
price int = "120000元"
)
cat string = "奧迪"
price int = "120000元"
)
2018-04-16
package main
import "fmt"
var a string = "zhao"
var NAME string = "qian"
type COUNT int
type person struct {}
type person interface {}
func fn() {}
func main() {}
import "fmt"
var a string = "zhao"
var NAME string = "qian"
type COUNT int
type person struct {}
type person interface {}
func fn() {}
func main() {}
2018-04-13