User Input

Go allows for user input.

That means we are able to ask the user for input.

package main

import (
	"fmt"
	"bufio"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	fmt.Print("Enter any character:")
	scanner.Scan()
	input := scanner.Text()
	fmt.Printf("You type: %q", input)
}
Categories: Mini-Programs