commit
263c8fa952
1
golearn/.gitignore
vendored
Normal file
1
golearn/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
golearn
|
1
golearn/guess_number/.gitignore
vendored
Normal file
1
golearn/guess_number/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
guess_number
|
40
golearn/guess_number/guess_number.go
Normal file
40
golearn/guess_number/guess_number.go
Normal file
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
36
golearn/test-code/main.go
Normal file
36
golearn/test-code/main.go
Normal file
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user