Browse Source

Initial commit

master
T. Meissner 4 years ago
commit
b05d597589
6 changed files with 103 additions and 0 deletions
  1. +20
    -0
      chapter_01/activity_1.01/main.go
  2. +21
    -0
      chapter_01/exercise_1.01/main.go
  3. +15
    -0
      chapter_01/exercise_1.02/main.go
  4. +20
    -0
      chapter_01/exercise_1.03/main.go
  5. +20
    -0
      chapter_01/exercise_1.04/main.go
  6. +7
    -0
      test/main.go

+ 20
- 0
chapter_01/activity_1.01/main.go View File

@ -0,0 +1,20 @@
package main
import (
"fmt"
)
func main() {
firstName := "Torsten"
familyName := "Meißner"
age := 41
peanutAllergy := false
fmt.Println(firstName)
fmt.Println(familyName)
fmt.Println(age)
fmt.Println(peanutAllergy)
}

+ 21
- 0
chapter_01/exercise_1.01/main.go View File

@ -0,0 +1,21 @@
package main
import (
"fmt"
"math/rand"
"strings"
"time"
)
func main() {
rand.Seed(time.Now().UnixNano())
r := rand.Intn(5) + 1
stars := strings.Repeat("*", r)
fmt.Println(stars)
}

+ 15
- 0
chapter_01/exercise_1.02/main.go View File

@ -0,0 +1,15 @@
package main
import "fmt"
var foo string = "bar"
func main() {
var baz string = "qux"
fmt.Println(foo, baz)
}

+ 20
- 0
chapter_01/exercise_1.03/main.go View File

@ -0,0 +1,20 @@
package main
import (
"fmt"
"time"
)
var (
Debug bool = false
LogLevel string = "info"
startUpTime time.Time = time.Now()
)
func main () {
fmt.Println(Debug, LogLevel, startUpTime)
}

+ 20
- 0
chapter_01/exercise_1.04/main.go View File

@ -0,0 +1,20 @@
package main
import (
"fmt"
"time"
)
var (
Debug bool
LogLevel = "info"
startUpTime = time.Now()
)
func main() {
fmt.Println(Debug, LogLevel, startUpTime)
}

+ 7
- 0
test/main.go View File

@ -0,0 +1,7 @@
package main
import (
"fmt"
)
func main() {
fmt.Println("This is a test")
}

Loading…
Cancel
Save