38 lines
782 B
Go
38 lines
782 B
Go
|
package main
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
func main() {
|
||
|
var firstname string
|
||
|
var lastname string
|
||
|
var age int
|
||
|
|
||
|
fmt.Println("Welcome to the Quiz game")
|
||
|
fmt.Printf("Enter your firstname and lastname: ")
|
||
|
fmt.Scan(&firstname, &lastname)
|
||
|
fmt.Printf("Enter your age: ")
|
||
|
fmt.Scan(&age)
|
||
|
|
||
|
if age >= 18 {
|
||
|
fmt.Println("Have fun gambling")
|
||
|
} else {
|
||
|
fmt.Println("You are too young for gambling")
|
||
|
fmt.Printf("You have to wait %v more year(s)", 18-age)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
fmt.Printf("What is better, 43 or 42")
|
||
|
var answer int
|
||
|
fmt.Scan(&answer)
|
||
|
|
||
|
if answer == 42 {
|
||
|
fmt.Println("You are right this unlooked the secret")
|
||
|
} else {
|
||
|
fmt.Println("You are wrong")
|
||
|
return
|
||
|
}
|
||
|
|
||
|
fmt.Println("########### DEBUG ###########")
|
||
|
fmt.Printf("Hello %v %v, you are %v years old\n", firstname, lastname, age)
|
||
|
}
|