Skip to content

Commit ba85c68

Browse files
committed
Initial commit
1 parent 5efd8f2 commit ba85c68

File tree

5 files changed

+15
-80
lines changed

5 files changed

+15
-80
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"blurb": "TODO: add blurb",
33
"authors": ["ErikSchierboom"],
4-
"contributors": []
4+
"contributors": ["bobtfish"]
55
}

concepts/packages/introduction.md

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,3 @@
33
TODO: the content below is copied from the exercise introduction and probably needs rewriting to a proper concept introduction
44

55
## packages
6-
7-
## functions
8-
9-
## variables
10-
11-
In Go an application is organized in packages. A package is a collection of source files located in the same folder. All source files in a folder must have the same package name at the top of the file. The package name is preferred to be the same as the folder it is located in.
12-
13-
```go
14-
package greeting
15-
```
16-
17-
Go is a statically-typed language, which means that everything has a type at compile-time. Assigning a value to a name is referred to as defining a variable. A variable can be defined either by explicitly specifying its type, or by assigning a value to have the Go compiler infer its type based on the assigned value.
18-
19-
```go
20-
var explicit int // Explicitly typed
21-
implicit := 10 // Implicitly typed
22-
```
23-
24-
The value of a variable can be assigned using the `:=` and updated using the `=`. Once defined, a variable's type can never change.
25-
26-
```go
27-
count := 1 // Assign initial value
28-
count = 2 // Update to new value
29-
30-
// Compiler error when assigning different type
31-
// count = false
32-
```
33-
34-
A function can have zero or more parameters. All parameters must be explicitly typed, there is no type inference for parameters. A function can also have multiple return values which must also be explicitly typed. Values are returned from functions using the `return` keyword. To allow a function to be called by code in other packages, the name of the function must start with a capital letter.
35-
36-
```go
37-
package greeting
38-
39-
// Hello is a public function
40-
func Hello(name string) string {
41-
return hello(name)
42-
}
43-
44-
// hello is a private function
45-
func hello(name string) string {
46-
return "Hello " + name
47-
}
48-
```
49-
50-
Invoking a function is done by specifying the function name and passing arguments for each of the function's parameters.
51-
52-
Go supports two types of comments. Single line comments are preceded by `//` and multiline comments are inserted between `/*` and `*/`.

concepts/packages/links.json

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,10 @@
11
[
22
{
3-
"url": "https://golang.org/ref/spec#Assignments",
4-
"description": "assignment"
3+
"url": "https://golang.org/ref/spec#Import_declarations",
4+
"description": "import-declaration"
55
},
66
{
7-
"url": "https://golang.org/ref/spec#Assignments",
8-
"description": "assignment"
9-
},
10-
{
11-
"url": "https://golang.org/ref/spec#Operators",
12-
"description": "operators"
13-
},
14-
{
15-
"url": "https://golang.org/ref/spec#Exported_identifiers",
16-
"description": "public-vs-private"
17-
},
18-
{
19-
"url": "https://golang.org/ref/spec#Method_declarations",
20-
"description": "methods"
21-
},
22-
{
23-
"url": "https://golang.org/ref/spec#Exported_identifiers",
24-
"description": "public-vs-private"
25-
},
26-
{
27-
"url": "https://golang.org/ref/spec#Return_statements",
28-
"description": "return"
29-
},
30-
{
31-
"url": "https://golang.org/ref/spec#Exported_identifiers",
32-
"description": "public-vs-private"
33-
},
34-
{ "url": "https://golang.org/ref/spec#Comments", "description": "comments" }
7+
"url": "https://golang.org/ref/spec#Package_clause",
8+
"description": "package"
9+
}
3510
]

config.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
"name": "Party Robot",
6262
"uuid": "b3594c44-1a68-489d-a446-16369247c84c",
6363
"concepts": [
64-
"string-formatting"
64+
"string-formatting",
65+
"packages"
6566
],
6667
"prerequisites": [
6768
"basics"
@@ -1816,6 +1817,11 @@
18161817
"slug": "numbers",
18171818
"uuid": "82cff17e-88cd-4707-a6d7-b5143251f029"
18181819
},
1820+
{
1821+
"name": "Packages",
1822+
"slug": "packages",
1823+
"uuid": "2062bff8-33ed-4081-8ad6-774b3410c450"
1824+
},
18191825
{
18201826
"name": "Range Iteration",
18211827
"slug": "range-iteration",

exercises/concept/party-robot/.meta/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"tehsphinx"
55
],
66
"contributors": [
7-
"oanaOM"
7+
"oanaOM",
8+
"bobtfish"
89
],
910
"files": {
1011
"solution": [

0 commit comments

Comments
 (0)