Go code
number, err := strconv.Atoi("12")
fmt.Println(number, err)Line-by-line explanation
- Atoi tries to convert text to int.
- Number receives the result.
- Err receives an error value.
- For valid text, err is nil.
Expected output
12 <nil>Nil means no error occurred.