Skip to content

Commit 39c2087

Browse files
committed
Remember, nobody can stop you from learning.
1 parent f175fa0 commit 39c2087

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package main
22

3+
import "fmt"
4+
35
func main() {
6+
foo()
7+
}
48

9+
// func, receiver, identifier, [parameter(s)], [return(s)], code block
10+
func foo() {
11+
fmt.Println("My first func")
512
}

000-br-bk-go-tour/07-functions/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ if err != nil {
233233

234234
### Type Error
235235

236-
Go is a statically-typed language, so type errors often occur at compile-time. However, you can also encounter them at runtime, for instance, when you're using interfaces and type assertions:
236+
Go is a statically-typed language, so type errors sometimes occur at compile-time. However, you can also encounter them at runtime, for instance, when you're using interfaces and type assertions:
237237

238238
```go
239239
var i interface{} = "a string"

000-br-bk-go-tour/07-functions/main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ func main() {
4949
x := param6(xi...)
5050
fmt.Println(x)
5151

52+
fmt.Println("------------- ANONYMOUS STUFF")
53+
// func (r receiver) identifier(parameter(s)) returns { code block }
54+
5255
// #8.1
5356
// anonymous func
5457
add := func(x, y int) int {
@@ -119,19 +122,19 @@ func hello() {
119122
// #2
120123
// return
121124
func hello2() string {
122-
return "Hello gophers!"
125+
return "Hello gophers 2!"
123126
}
124127

125128
// #3
126129
// returns
127130
func hello3() (string, int) {
128-
return "Hello gophers!", 42
131+
return "Hello gophers 3!", 42
129132
}
130133

131134
// #4
132135
// parameters
133136
func param4(fn string) string {
134-
s := "Hello" + fn
137+
s := "Hello " + fn
135138
return s
136139
}
137140

0 commit comments

Comments
 (0)