-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray.go
41 lines (35 loc) · 836 Bytes
/
array.go
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
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"fmt"
// "bytes"
"encoding/json"
// "math/big"
//"math"
)
func main() {
/* Simple Arrays */
var arr [5]string
arr[0] = "a"
arr[1] = "b"
arr[2] = "c"
arr[3] = "d"
arr[4] = "e"
fmt.Println(arr)
arr1:=[]string{}
row1:="abcd"
row2:="abcde"
arr1=append(arr1,row1)
arr1=append(arr1,row2)
fmt.Println(arr1)
/* Simple Array END */
/* 2D Array */
twoDarray:=[][]string{}
first:=[]string{"hello","world","go"}
second:=[]string{"ready","get","set","go"}
twoDarray=append(twoDarray,first)
twoDarray=append(twoDarray,second)
fmt.Println(twoDarray)
jsonString,_:=json.Marshal(twoDarray)
fmt.Println(string(jsonString))
/* 2D Array End*/
}