Map

作者: tonyemail_st | 来源:发表于2018-06-18 21:21 被阅读0次

    常见操作:http://www.runoob.com/go/go-map.html

    1. 创建Map
    2. 赋值
    3. 遍历Map
    4. 查看某个元素(键)是否在集合中
    5. delete()删除Map中的某个键

    【练习1】

    1. 创建countryCapitalMap,键与值都是字符串
    2. 添加数据
    Country(Key) Capital (Value)
    France Paris
    Italy Rome
    Japan ToKyo
    India New Delhi
    1. 遍历Map,输出所有国家与首都
    2. 查看“USA”是否在国家里面
    3. 删除“France”条目

    Map-参考答案

    相关文章

      网友评论

          本文标题:Map

          本文链接:https://www.haomeiwen.com/subject/mnxoeftx.html