From 3bf74b3ddae006353069218563cbcd370c88aaaa Mon Sep 17 00:00:00 2001 From: Samuel Marks Date: Wed, 22 Apr 2015 23:54:16 +1000 Subject: Fixed grammar, added explanation of function signature and arguments --- go.html.markdown | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'go.html.markdown') diff --git a/go.html.markdown b/go.html.markdown index 9b9758b4..9fce7a9b 100644 --- a/go.html.markdown +++ b/go.html.markdown @@ -64,7 +64,11 @@ func beyondHello() { learnTypes() // < y minutes, learn more! } -// Functions can have parameters and (multiple!) return values. +/* <- multiline comment +Functions can have parameters and (multiple!) return values. +Here `x`, `y` are the arguments and `sum`, `prod` is the signature (what's returned). +Note that `x` and `sum` receive the type `int`. +*/ func learnMultiple(x, y int) (sum, prod int) { return x + y, x * y // Return two values. } @@ -83,7 +87,7 @@ can include line breaks.` // Same string type. f := 3.14195 // float64, an IEEE-754 64-bit floating point number. c := 3 + 4i // complex128, represented internally with two float64's. - // Var syntax with an initializers. + // var syntax with initializers. var u uint = 7 // Unsigned, but implementation dependent size as with int. var pi float32 = 22. / 7 -- cgit v1.2.3 From 1faab2901edb8c2e1eda708af8b37f3ec62dfd78 Mon Sep 17 00:00:00 2001 From: Samuel Marks Date: Thu, 23 Apr 2015 00:02:33 +1000 Subject: Fallthrough --- go.html.markdown | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'go.html.markdown') diff --git a/go.html.markdown b/go.html.markdown index 9fce7a9b..34b855e3 100644 --- a/go.html.markdown +++ b/go.html.markdown @@ -181,6 +181,10 @@ func learnFlowControl() { case 1: case 42: // Cases don't "fall through". + /* + There is a `fallthrough` keyword however, see: + https://github.com/golang/go/wiki/Switch#fall-through + */ case 43: // Unreached. default: -- cgit v1.2.3