Go Short Variable Declaration Invalid Cases: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Lexical Structure =With =")
 
No edit summary
Line 3: Line 3:
* [[Go_Concepts_-_Lexical_Structure#Short_Variable_Declaration|Lexical Structure]]
* [[Go_Concepts_-_Lexical_Structure#Short_Variable_Declaration|Lexical Structure]]


=With =
=With Method Receivers' Fields=
 
<pre>
...
 
type A struct {
    i int
}
 
func (a A) m(i int) {
    a.i := i + 1 // invalid, the compiler will complain: ""
}
...
</pre>

Revision as of 10:57, 4 April 2016

Internal

With Method Receivers' Fields

...

type A struct {
    i int
}

func (a A) m(i int) {
    a.i := i + 1 // invalid, the compiler will complain: ""
}
...