logo
  • 教程列表
  • SO官方文档
  • 关联数组
    • 标准使用
    • 字面
    • 添加键值对
    • 删除键值对
    • 检查是否存在密钥
  1. StackOverflow 文档
  2. D Language 教程
  3. 关联数组
  4. 添加键值对

添加键值对

Created: November-22, 2018

int[string] aa = ["x": 5, "y": 6];
// The value can be set by its key:
aa["x"] = 7;
assert(aa["x"] == 7);
// if the key does not exist will be added
aa["z"] = 8;
assert(aa["z"] == 8);
  • 删除键值对
  • 字面

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明