<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ### 實例 ~~~ var a [5]int a[0] = 100 var a [5]int = [5]int{1, 2, 3, 4, 5} fmt.Println(a) b := [5]int{1, 2, 3, 4, 5} fmt.Println(b) c := [5]int{1, 2, 3} //未賦值的為零值 fmt.Println(c) d := [5]int{2: 10, 4: 20} fmt.Println(d) ~~~ ~~~ [1 2 3 4 5] [1 2 3 4 5] [1 2 3 0 0] [0 0 10 0 20] ~~~ ### 二維數組 有多少個[]就是多少維 #### 賦值 ~~~ var a [3][4]int v := 0 for i := 0; i < 3; i++ { for j := 0; j < 4; j++ { v++ a[i][j] = v } } fmt.Println(a) ~~~ #### 聲明并賦值 ~~~ a := [3][4]int{ {1, 2, 3, 4}, {6, 7, 8, 9}, {10, 11, 12, 13}, } fmt.Println(a) b := [3][4]int{ {1,}, {2, 3,}, {4, 5}, } fmt.Println(b) c := [3][4]int{ 0: {0: 3}, 1: {1: 4}, 2: {2: 6}, } fmt.Println(c) ~~~ ~~~ [[1 2 3 4] [6 7 8 9] [10 11 12 13]] [[1 0 0 0] [2 3 0 0] [4 5 0 0]] [[3 0 0 0] [0 4 0 0] [0 0 6 0]] ~~~ #### 數組進行比較 比較相同類型的每一個元素是否相等 ~~~ a := [3]int{1,2,3} b := [3]int{1,2,3} c := [3]int{4,5,6} d := [4]int{1,2,3,4} fmt.Println(a == b) fmt.Println(a == c) fmt.Println(a == d) //這里報錯,因為類型不相同 ~~~ ~~~ true false src/test/test.go:13:16: invalid operation: a == d (mismatched types [3]int and [4]int) ~~~ ### 產生隨機數 ~~~ //設置種子,只需一次,如果種子參數一樣,每次運行程序產生的隨機數都一樣 rand.Seed(time.Now().UnixNano()) //以當前系統時間作為種子參數 fmt.Println(rand.Intn(100)) //產生隨機數 ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看