摘要:
Go has built-in support for multiple return values. This feature is used often in idiomatic Go, for example to return both result and error values fro... 阅读全文
摘要:
Functions are central in Go. We'll learn about functions with a few different examplespackage mainimport ( "fmt")func plus(a int, b int) int { r... 阅读全文
摘要:
range iterates over of elements in variety of data structures. Let's see how use range with some of the data structures we've already leranedpackage m... 阅读全文
摘要:
Maps are Go's built-in associative data type(sometimes called hashes or dits in other languages)package mainimport ( "fmt")func main() { m := ma... 阅读全文
摘要:
Slices are a key data type in Go, giving a more powerful interface to sequences than arrayspackage mainimport ( "fmt")func main() { s := make([]... 阅读全文
摘要:
in Go, an array is a numbered sequence of elements of a specific lengthpackage mainimport ( "fmt")func main() { var a [5]int fmt.Println("emp... 阅读全文