How to read from standard input in the console?

后端 未结 11 1178
迷失自我
迷失自我 2020-11-28 00:54

I would like to read standard input from the command line, but my attempts have ended with the program exiting before I\'m prompted for input. I\'m looking for the equivalen

11条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 01:38

    Try this code:-

    var input string
    func main() {
          fmt.Print("Enter Your Name=")
          fmt.Scanf("%s",&input)
          fmt.Println("Hello "+input)
          }
    

提交回复
热议问题