Skip to content

Comments

Delete variable assignment from variable declarations section in Go#2203

Open
DrAlexHarrison wants to merge 1 commit intorstacruz:masterfrom
DrAlexHarrison:patch-2
Open

Delete variable assignment from variable declarations section in Go#2203
DrAlexHarrison wants to merge 1 commit intorstacruz:masterfrom
DrAlexHarrison:patch-2

Conversation

@DrAlexHarrison
Copy link

Admittedly, I'm at a junior dev level, but I believe the code as written is syntactically incorrect. I think that the : is required for msg to be declared as a variable. I don't believe you can just use the assignment operator (=) to declare msg as a variable by assigning it the value of "Hello" in the 'Go!' language like you can in python, dart, et al.

Go! does have type inference but it must be done with the walrus operator (:=). Line 49 denotes that this is the Variable Declaration section so I believe the : preceding the = is necessary.

On deeper checking, I think this line should be deleted because it's syntactically incorrect and the shortcut for variable declaration and assignment using the walrus operator is already covered below.

Admittedly, I'm at a junior dev level, but I believe the code as written is syntactically incorrect. I think that the `:` is required for `msg` to be declared as a variable.  I don't believe you can just use the assignment operator (`=`) to declare `msg` as a variable by assigning it the value of `"Hello"` in the 'Go!' language like you can in python, dart, et al.

Go! does have type inference but it must be done with the walrus operator (`:=`).  Line 49 denotes that this is the `Variable Declaration` section so I believe the `:` preceding the `=` is necessary.

On deeper checking, I think this line should be deleted because it's syntactically incorrect and the shortcut for variable declaration and assignment using the walrus operator is already covered below.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant