0

I am new to Go, and wanted to display a text to the user and wait for the user to press any key. As soon as the user presses a key, it should proceed to the next line of code else it should stay there. How do we achieve that in Go?

Let's say the text is: "Press any key to proceed..." and I display as:

fmt.Printf(Press any key to proceed...")

After this how do I detect whether a key was pressed in order to continue?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
user1892775
  • 2,001
  • 6
  • 37
  • 58

0 Answers0