fmt.Scan I'm going to write the understanding of Go from the basics of programming!
fmt.Scan
var input string
fmt.Scan(&input) //❶fmt.scan(&Variable name)Enter characters on the console with
}
//console
Go //❷ Input character string → ❸ Value Go entered in variable input is assigned
Input on the console is possible using fmt.Scan (& variable name) The input value is assigned to the variable input
func main() {
var input string
fmt.Println("Please enter the following words:go") //❶
fmt.Scan(&input) //❷
fmt.Printf("%s was entered", input) //❸
//console
//❶ Enter the following words:go
//❷go(Type in console)
//❸ entered
You can use fmt.Scan to input
Recommended Posts