function
setup() {
createCanvas(550, 300);
textSize(16);
let stringDict =
createStringDict(
"Tokyo"
,
"37.26 million"
);
text(
"New string dictionary created "
+
"with one key"
, 20, 20);
let currSize = stringDict.size();
print(
"Printing "
+ currSize +
" key-value pair(s):"
);
stringDict.print();
text(
"Dictionary keys printed to console"
,
20, 60);
let tmpObj = {
"Delhi"
:
"25.87 million"
,
"Shanghai"
:
"23.48 million"
,
"Mexico City"
:
"21.34 million"
};
stringDict.create(tmpObj);
text(
"New keys added to the dictionary"
,
20, 100);
currSize = stringDict.size();
print(
"Printing "
+ currSize +
" key-value pair(s):"
);
stringDict.print();
text(
"Dictionary keys printed to console"
,
20, 140);
}