Merge pull request #157 from guozhiwei/patch-1

Update 02.3.md
This commit is contained in:
astaxie
2013-02-20 07:02:47 -08:00

View File

@@ -367,7 +367,7 @@ Go语言中有种不错的设计即延迟defer语句你可以在函
在Go中函数也是一种变量我们可以通过`type`来定义它,它的类型就是所有拥有相同的参数,相同的返回值的一种类型
type typeName func(input1 inputType1 [, input2 inputType2 [, ...]) (result1 resultType1 [, ...])
type typeName func(input1 inputType1 , input2 inputType2 [, ...]) (result1 resultType1 [, ...])
函数作为类型到底有什么好处呢?那就是可以把这个类型的函数当做值来传递,请看下面的例子