36 lines
708 B
Go
36 lines
708 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
var num float64
|
|
var name string
|
|
|
|
func main() {
|
|
nameget()
|
|
|
|
startup(num)
|
|
|
|
compare(num)
|
|
}
|
|
|
|
func startup(number float64) {
|
|
fmt.Printf("Alright %s, give me a number, I will tell you if it's between 1 and 10\n", name)
|
|
fmt.Printf("Number: ")
|
|
fmt.Scan(&num)
|
|
return
|
|
}
|
|
|
|
func nameget() {
|
|
fmt.Println("Welcome to this simple program, may I know your name?\n(Please don't use spaces, I still haven't figured out how to parse them all together into a string)")
|
|
fmt.Printf("Name: ")
|
|
fmt.Scanln(&name)
|
|
}
|
|
|
|
func compare(number float64) {
|
|
if number >= 1 && number <= 10 {
|
|
fmt.Printf("The number is between 1 and 10\n")
|
|
} else {
|
|
fmt.Printf("The number isn't between 1 and 10\n")
|
|
}
|
|
}
|