Alright.

Thanks guys.

On Friday, November 18, 2016 at 10:22:06 AM UTC-5, Terry McKenna wrote:
>
> Hi Guys,
>
> I am reading "The Go Programming Language": Donovan, Kernighan (pg.31):
>
> "One subtle but important point: a short variable declaration does not 
> necessarily declare all the variables on the its left-hand side. If some of 
> them were already declared in the same lexical block then then the short 
> variable declaration acts like an assignment to those variables."
>
> I get that.
>
> "In the code below, the first statement declares both in and err. The 
> second declares out but only assigns a value to the existing err variable:
>
> in, err := os.Open(infile)
> // ...
> out, err := os.Create(outfile)
>
> A short variable declaration must declare at least one new variable ...."
>
> My question is, the second declaration (out, err := os.Create(outfile)), 
> is declaring a new var so why is the value from "os.Create(outfile)" not 
> assigned to out? I understand that err is updated but again, why is no 
> value assigned to the variable out?
>
> Thanks
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to