Hmm, but this prints 123:
func main() {
var code int
code, err := myfunc()
if err != nil {
fmt.Printf("Error: %s", err)
return
}
fmt.Printf("code is %d", code)
}
OK, so it must be to do with "if" declaring a new block scope:
*"An identifier declared in a block may be redeclared in an inner block.
While the identifier of the inner declaration is in scope, it denotes the
entity declared by the inner declaration."*
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/golang-nuts/0dc102ff-196f-475f-81fe-d05525ca4d8bn%40googlegroups.com.