[Go] Scan

  • Scan reads user input
  • Takes a pointer as an argument
  • Typed data is written to pointer
  • Return number of scanned items
var appleNum int

fmt.Printf("Number of apples?")

num, err := fmt.Scan(&appleNum)

fmt.Printf(appleNum)

 

posted @ 2022-09-08 18:07  Zhentiw  阅读(22)  评论(0)    收藏  举报