<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Go語(yǔ)言入門(3) - 地圖 Get started with the Go language

          共 981字,需瀏覽 2分鐘

           ·

          2022-11-22 11:22

          今日單詞  Words for today

          values 值

          demonstrates 演示

          print 打印

          output 輸出

          Maps

          The Go map statement maps keys to values. As with slice, you create a map with make, not new. In the following example, we map string keys to integer values. This code demonstrates inserting, updating, deleting, and testing for map elements.

          GO的map語(yǔ)句將鍵映射到值,與slice一樣,你創(chuàng)建一個(gè)map用make而不是用new,在以下示例中,我們將字符串鍵映射到整數(shù)值。此代碼演示了地圖元素的插入、更新、刪除和測(cè)試。

          package main

          import "fmt"

          func main() {
            m := make(map[string]int)

            m["Answer"] = 42
            fmt.Println("The value:", m["Answer"])

            m["Answer"] = 48
            fmt.Println("The value:", m["Answer"])

            delete(m, "Answer")
            fmt.Println("The value:", m["Answer"])

            v, ok := m["Answer"]
            fmt.Println("The value:", v, "Present?", ok)
          }

          Here is the program's print output:

          程序的輸出結(jié)果如下:

          The value: 42
          The value: 48 
          The value: 0
          The value: 0 Present? false



          瀏覽 30
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  日日外国老女人 | 亚洲天堂网站 | 国产精品久久久久久久久毛毛 | 在线视频免费电影亚洲色图 | 一区性感在线观看 |