strconv.Atoi in Go (Basic calculator)
问题 I'm trying to make a basic adding calculator in Go (complete noob here), but every time I'm getting an output of 0. This is the code: package main import ( "fmt" "strconv" //"flag" "bufio" "os" ) func main(){ reader := bufio.NewReader(os.Stdin) fmt.Print("What's the first number you want to add?: ") firstnumber, _ := reader.ReadString('\n') fmt.Print("What's the second number you want to add?: ") secondnumber, _ := reader.ReadString('\n') ifirstnumber, _ := strconv.Atoi(firstnumber)