文章 2015-11-22 来自:开发者社区

learn go memoization

package main // 参考文章: // https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/06.12.md import ( "fmt" "time" ) const LIM = 41 var fibs [LIM]uint64 func main() { var r...

文章 2015-11-22 来自:开发者社区

learn go return fuction

package main // 参考文章: // https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/06.9.md import "fmt" func main() { var f = Adder() fmt.Print(f(1), " - ") fmt.Print(f(20),...

文章 2015-11-22 来自:开发者社区

learn go anonymous function

package main // 参考文档: // https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/06.8.md import "fmt" func main() { f() } func f() { for i := 0; i < 4; i++ { g := ...

文章 2015-11-22 来自:开发者社区

learn go function callback

package main // 参考文档: // https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/06.7.md import ( "fmt" ) func main () { callback(1, Add) } func Add(a, b int) { fmt.Print...

文章 2015-11-22 来自:开发者社区

learn go recursive

package main // 参考文章: // https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/06.6.md import ( "fmt" ) func main () { fmt.Printf("%d is even: is %t\n", 16, even(16)) // 16...

文章 2015-11-22 来自:开发者社区

learn go defer

package main // 参考文档: // https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/06.4.md import "fmt" func main() { function1() } func function1() { fmt.Printf("In function1 ...

文章 2015-11-22 来自:开发者社区

learn go error

package main // 参考文档: // https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/05.2.md import ( "fmt" "strconv" ) func main() { var orig string = "ABC" // var an in...

文章 2015-11-22 来自:开发者社区

learn go ifelse

package main // 参考文档: // https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/05.1.md import "fmt" func main() { var first int = 10 var cond int if first <= 0 { ...

文章 2015-11-22 来自:开发者社区

learn go random

1 package main 2 3 // 参考文档: 4 // go 基本类型和运算符 5 // https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/04.5.md 6 7 // 引入需要使用的类 8 import ( 9 "fmt" // 格式...

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

产品推荐

开发与运维

集结各类场景实战经验,助你开发运维畅行无忧

+关注