@kjk1/

book multiple variables

Go

No description

fork
loading
Files
  • main.go

This Plugin Crashed!

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

func main() {
	// :show start
	// You can declare multiple variables of the same type in one line
	var a, b, c string

	var d, e string = "Hello", "world!"

	// You can also use short declaration to assign multiple variables
	x, y, z := 1, 2, 3

	foo, bar := 4, "stack" // `foo` is type `int`, `bar` is type `string`
	// :show end

	// silence compiler error about unused variables
	_, _, _, _, _, _, _, _, _, _ = a, b, c, d, e, x, y, z, foo, bar
}