-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
func main() { | ||
a, b, c := 1, 2 | ||
_, _, _ = a, b, c | ||
} | ||
|
||
// Error: | ||
// _test/assign19.go:4:2: cannot assign 2 values to 3 variables |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
import ( | ||
"errors" | ||
) | ||
|
||
func ShortVariableDeclarations() (i int, err error) { | ||
r, err := 1, errors.New("test") | ||
i = r | ||
return | ||
} | ||
|
||
func main() { | ||
_, er := ShortVariableDeclarations() | ||
if er != nil { | ||
println("ShortVariableDeclarations ok") | ||
} else { | ||
println("ShortVariableDeclarations not ok") | ||
} | ||
} | ||
|
||
// Output: | ||
// ShortVariableDeclarations ok |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.