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

  • 關於本站
  • 免責聲明