Samir Mishra

You may use the “Scanln” function to take input from the user in Golang.

In the Go language, the “Scanln” function scans the input texts given as inputs, and saves the respective values into repective arguments.

The following is an instance of taking input from the user:

screenshot of program taking input
Screenshot of code taking input from user.

Save this file now and run it using a command in terminal which seems like this:

go run <filename.go>

Here is the screenshot of output given by this program.