@kjk1/

book multiple variable

Go

No description

fork
loading
Files
  • main.go

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.1864335659398142","path":"main.go","file":{"path":"main.go","content":{"asEncoding":{"base64":"cGFja2FnZSBtYWluCgppbXBvcnQgImZtdCIKCi8vIDpzaG93IHN0YXJ0CmZ1bmMgbXVsdGlwbGVSZXR1cm4oKSAoaW50LCBpbnQpIHsKCXJldHVybiAxLCAyCn0KCmZ1bmMgbXVsdGlwbGVSZXR1cm4yKCkgKGEgaW50LCBiIGludCkgewoJYSA9IDMKCWIgPSA0CglyZXR1cm4KfQoKZnVuYyBtYWluKCkgewoJeCwgeSA6PSBtdWx0aXBsZVJldHVybigpICAvLyB4ID0gMSwgeSA9IDIKCXcsIHogOj0gbXVsdGlwbGVSZXR1cm4yKCkgLy8gdyA9IDMsIHogPSA0CglmbXQuUHJpbnRmKCJ4OiAlZCwgeTogJWRcbnc6ICVkLCB6OiAlZFxuIiwgeCwgeSwgdywgeikKCS8vIDpzaG93IGVuZAp9Cg=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import "fmt"

// :show start
func multipleReturn() (int, int) {
	return 1, 2
}

func multipleReturn2() (a int, b int) {
	a = 3
	b = 4
	return
}

func main() {
	x, y := multipleReturn()  // x = 1, y = 2
	w, z := multipleReturn2() // w = 3, z = 4
	fmt.Printf("x: %d, y: %d\nw: %d, z: %d\n", x, y, w, z)
	// :show end
}