fmt.Scan()
This function can be used to get user input. The variable need to be passed as a pointer by adding the & sign.
var investmentAmount float64
fmt.Scan(&investmentAmount)The fmt.Scan() function is a great function for easily fetching & using user input through the command line.
But this function also has an important limitation: You can't (easily) fetch multi-word input values. Fetching text that consists of more than a single word is tricky with this function.
Last updated