I am trying out the simple following conversion program.
package main import ( "fmt" "strconv" ) func main(){ var numStr string="2213" var numVar int64 numVar,err=strconv.ParseInt(numStr,10,64) fmt.Println(numVar) } The above throws the following compilation error.
undefined: err Then I tried to define the err, error variable.
package main import ( "fmt" "strconv" ) func main(){ var numStr string="2213" var numVar int64 var err error numVar,err=strconv.ParseInt(numStr,10,64) fmt.Println(numVar) } But then the compiler throws the following error this time.
err declared and not used I referred to the following stackoverflow question Undefined err variable but did not get complete understanding of the behavior and hence asking the question here.