| --- |
| title: MultiValAssignOp |
| layout: article |
| --- |
| <!-- Copyright 2023 The Go Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style |
| license that can be found in the LICENSE file. --> |
| |
| <!-- Code generated by generrordocs.go; DO NOT EDIT. --> |
| |
| ``` |
| MultiValAssignOp occurs when an assignment operation (+=, *=, etc) does |
| not have single-valued left-hand or right-hand side. |
| |
| Per the spec: |
| "In assignment operations, both the left- and right-hand expression lists |
| must contain exactly one single-valued expression" |
| |
| Example: |
| func f() int { |
| x, y := 1, 2 |
| x, y += 1 |
| return x + y |
| } |
| ``` |
| |