@kjk1/

book array indexes 2

Go

No description

fork
loading
Files
  • main.go

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.7450943846244136","path":"main.go","file":{"path":"main.go","content":{"asEncoding":{"base64":"cGFja2FnZSBtYWluCgppbXBvcnQgImZtdCIKCmZ1bmMgbWFpbigpIHsKCS8vIDpzaG93IHN0YXJ0Cgl2YXIgYXJyYXkgPSBbNl1pbnR7MSwgMiwgMywgNCwgNSwgNn0KCglmbXQuUHJpbnRsbihhcnJheSkgLy8gPiBbMSAyIDMgNCA1IDZdCgoJYXJyYXlbMF0gPSA2CglmbXQuUHJpbnRsbihhcnJheSkgLy8gPiBbNiAyIDMgNCA1IDZdCgoJYXJyYXlbMV0gPSA1CglmbXQuUHJpbnRsbihhcnJheSkgLy8gPiBbNiA1IDMgNCA1IDZdCgoJYXJyYXlbMl0gPSA0CglmbXQuUHJpbnRsbihhcnJheSkgLy8gPiBbNiA1IDQgNCA1IDZdCgoJYXJyYXlbM10gPSAzCglmbXQuUHJpbnRsbihhcnJheSkgLy8gPiBbNiA1IDQgMyA1IDZdCgoJYXJyYXlbNF0gPSAyCglmbXQuUHJpbnRsbihhcnJheSkgLy8gPiBbNiA1IDQgMyAyIDZdCgoJYXJyYXlbNV0gPSAxCglmbXQuUHJpbnRsbihhcnJheSkgLy8gPiBbNiA1IDQgMyAyIDFdCgkvLyA6c2hvdyBlbmQKfQ=="},"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
23
24
25
26
27
28
29
package main

import "fmt"

func main() {
	// :show start
	var array = [6]int{1, 2, 3, 4, 5, 6}

	fmt.Println(array) // > [1 2 3 4 5 6]

	array[0] = 6
	fmt.Println(array) // > [6 2 3 4 5 6]

	array[1] = 5
	fmt.Println(array) // > [6 5 3 4 5 6]

	array[2] = 4
	fmt.Println(array) // > [6 5 4 4 5 6]

	array[3] = 3
	fmt.Println(array) // > [6 5 4 3 5 6]

	array[4] = 2
	fmt.Println(array) // > [6 5 4 3 2 6]

	array[5] = 1
	fmt.Println(array) // > [6 5 4 3 2 1]
	// :show end
}