2024-01-22 14:23:12 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-01-24 06:56:48 +01:00
|
|
|
"bufio"
|
2024-01-22 14:23:12 +01:00
|
|
|
"fmt"
|
2024-01-24 06:56:48 +01:00
|
|
|
//"log"
|
|
|
|
"os"
|
2024-01-22 14:23:12 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func nameget() {
|
2024-01-24 06:56:48 +01:00
|
|
|
fmt.Println("Welcome to this simple program, may I know your name?\n(You can use spaces now, I figured out how to use the bufio library)")
|
2024-01-22 14:23:12 +01:00
|
|
|
fmt.Printf("Name: ")
|
|
|
|
|
2024-01-24 06:56:48 +01:00
|
|
|
reader := bufio.NewReader(os.Stdin)
|
|
|
|
name, _ = reader.ReadString('\n')
|
|
|
|
|
|
|
|
// Hold that thought, I'm pretty sure bufio might be infinitely better, scan keeps bothering me by not
|
|
|
|
// accepting spaced out words
|
|
|
|
|
2024-01-22 14:23:12 +01:00
|
|
|
// It has come to my attention that scan actually spits out two values, default and err
|
2024-01-24 06:56:48 +01:00
|
|
|
// _, err := fmt.Scanln(&name)
|
2024-01-22 14:23:12 +01:00
|
|
|
|
|
|
|
// nil is literally the equivalent of null, we're just checking here if err is not null,
|
|
|
|
// and if it isn't, it means an error has ocurred so we're just gonna panic and kill the program
|
2024-01-24 06:56:48 +01:00
|
|
|
// if err != nil {
|
|
|
|
// log.Fatal(err)
|
|
|
|
// }
|
2024-01-22 14:23:12 +01:00
|
|
|
}
|