Skip to content

Commit

Permalink
Ninja level 1 solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
abk-code committed Oct 16, 2018
1 parent b9f9822 commit 4e0e4c0
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions 03_variables/04_exercise_solutions/ninja-level1.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package main

import "fmt"

var x int = 42
var y string = "James Bond"
var z bool = true

type abk_int int
type hotdog int

var x_myint abk_int

func main() {

// exercise3()
// exercise4()
exercise5()

}

func exercise3() {

s := fmt.Sprintf("%d %s %t",x,y,z)
fmt.Println(s)
}

func exercise4() {
fmt.Printf("%d %T\n",x_myint,x_myint)
x_myint = abk_int(100)

fmt.Printf("%d %T\n",x_myint,x_myint)
}

func exercise5() {
fmt.Printf("%d %T\n",x_myint,x_myint)
x_myint = abk_int(100)
fmt.Printf("%d %T\n",x_myint,x_myint)

x = int(x_myint)
fmt.Printf("%d %T\n",x, x)

}

0 comments on commit 4e0e4c0

Please sign in to comment.