- https://headfirstgo.com/
- Chapter 2
Last active
March 20, 2023 19:32
-
-
Save destinio/d601d0c8a6cff65545477395d4b270db to your computer and use it in GitHub Desktop.
simple user input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"log" | |
"os" | |
) | |
func main() { | |
fmt.Print("Enter something: ") | |
reader := bufio.NewReader(os.Stdin) | |
input, err := reader.ReadString('\n') | |
if err != nil { | |
log.Fatal(err) | |
} | |
fmt.Println(input) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment