Dear, Ian.
You are correct and I was wondering why the reassignment did not work in
the case of *x *var*. *I found the answer in the Effective Go
documentation, in the *Redeclaration and reassignment* section:
In a := declaration *a variable v may appear even if it has already been
> declared*, *
On Mon, Jan 17, 2022 at 7:07 PM Paulo Júnior wrote:
>
> I'm studying about if statement and comma ok construction and I'm not sure
> why the piece of code (https://go.dev/play/p/ScFJsih6lwR) bellow does not
> work. The compiler says that: x declared but not used. However, x is used in
> the sec
Hi all.
I'm studying about *if statement* and *comma ok construction* and I'm not
sure why the piece of code (https://go.dev/play/p/ScFJsih6lwR) bellow does
not work. The compiler says that: *x declared but not used*. However, *x* is
used in the second *if statement *of the *main function*, as