diff --git a/golearn/.gitignore b/golearn/.gitignore new file mode 100644 index 0000000..a803526 --- /dev/null +++ b/golearn/.gitignore @@ -0,0 +1 @@ +golearn diff --git a/golearn/guess_number/.gitignore b/golearn/guess_number/.gitignore new file mode 100644 index 0000000..1d855af --- /dev/null +++ b/golearn/guess_number/.gitignore @@ -0,0 +1 @@ +guess_number \ No newline at end of file diff --git a/golearn/guess_number/guess_number.go b/golearn/guess_number/guess_number.go new file mode 100644 index 0000000..45ac90c --- /dev/null +++ b/golearn/guess_number/guess_number.go @@ -0,0 +1,40 @@ +package main + +import ("fmt" + "math/rand" + "time" + ) + +func input(var Text string){ + fmt.Printf(text) + fmt.Scan(&text) + return Text +} +func main(){ + rand.Seed(time.Now().UnixNano()) + var randNumber int = rand.Int()%100 + + stuff := true + + for stuff == true{ + + fmt.Print("Guess a number between 1 and 100: ") + var guess int + fmt.Scan(&guess) + + if guess > randNumber{ + fmt.Println("Too High") + + }else if guess < randNumber{ + fmt.Print("Too low" + "\n") + + + }else if guess == randNumber{ + fmt.Println("Correct") + + }else{ + fmt.Println("What the fuck") + } + } + +} \ No newline at end of file diff --git a/golearn/test-code/main.go b/golearn/test-code/main.go new file mode 100644 index 0000000..c180461 --- /dev/null +++ b/golearn/test-code/main.go @@ -0,0 +1,36 @@ +package main + +import ("fmt") + +func main(){ + var myPrintf string = "This is my Printf" + var myPrintln string = "This is my Println" + var myPrint string = "This is my Print" + var myArray[5] string; + + myArray[0] = "hi" + + println := fmt.Println + printf := fmt.Printf + + println(myPrintln) + printf(myPrintf + "\n") + print(myPrint + "\n") + + println(myArray[0]) + + f := 11 + g := 23 + + fmt.Println(f + g) + + if f == 12 { + fmt.Println("yes") + }else + + { + fmt.Println("no") + } + return +} +