cary = Associative Array();
cary = [=> ];
cary = Associative Array();
cary["state"] = "NC";
cary["population"] = 116234;
cary["weather"] = "cloudy";
cary["population"] += 10;
cary["weather"] = "sunny";
cary["high schools"] = {"Cary", "Green Hope", "Panther Creek"};
cary = Associative Array();
cary << Set Default Value( "Cary, NC" );
連想配列にデフォルト値が設定されているかどうかを確かめるには、<<Get Default Valueメセージを使用します。
cary << Get Default Value;
デフォルト値がない場合は、Empty()が戻されます。
Set Default Valueメッセージ以外に、連想配列のリテラルを指定する際にキーなしの=>valueを使用することによってもデフォルト値を設定できます。
counts = ["a" => 10,
"b" => 3,
=> 0]; // デフォルト値は0
counts["c"] += 1;
Show( counts );
map = [=>];
map = Associative Array();
map = [=>0];
map = Associative Array( 0 );
map = ["yes" => 0, "no" => 1];
map = ["yes" => 0, "no" => 1, => 2];
map = ["yes" => 0, "no" => 1, "alt" => ["a" => "1", "b" => "2"]];
map = Associative Array( {{"yes", 0}, {"no", 1}} );
map = Associative Array( {{"yes", 0}, {"no", 1}}, 2 );
map = Associative Array( {"yes", "no"}, {0, 1} );
map = Associative Array( {"yes", "no"}, {0, 1}, 2 );
map = Associative Array( :name, :height );
map = Associative Array(:name, :height, .);
set = Associative Array( {"yes", "no"} );
set = Associative Array( :name );