-
-
Add the given number to the value currently stored at the given key.
The sum then replaces the value previously stored in the Dictionary.
Parameters:
Name |
Type |
Description |
Key |
Number
|
for the value you wish to add to |
Number |
Number
|
to add to the value |
Example
function setup() {
let myDictionary = createNumberDict(2, 5);
myDictionary.add(2, 2);
print(myDictionary.get(2)); // logs 7 to console.
}
-
-
Divide the given number with the value currently stored at the given key.
The quotient then replaces the value previously stored in the Dictionary.
Parameters:
Name |
Type |
Description |
Key |
Number
|
for value you wish to divide |
Amount |
Number
|
to divide the value by |
Example
function setup() {
let myDictionary = createNumberDict(2, 8);
myDictionary.div(2, 2);
print(myDictionary.get(2)); // logs 4 to console.
}
-
-
Return the highest key currently used in the Dictionary.
Returns:
Number
Example
function setup() {
let myDictionary = createNumberDict({ 2: 4, 4: 6, 1.2: 3 });
let highestKey = myDictionary.maxKey(); // value is 4
print(highestKey);
}
-
-
Return the highest number currently stored in the Dictionary.
Returns:
Number
Example
function setup() {
let myDictionary = createNumberDict({ 2: -10, 4: 0.65, 1.2: 3 });
let highestValue = myDictionary.maxValue(); // value is 3
print(highestValue);
}
-
-
Return the lowest key currently used in the Dictionary.
Returns:
Number
Example
function setup() {
let myDictionary = createNumberDict({ 2: 4, 4: 6, 1.2: 3 });
let lowestKey = myDictionary.minKey(); // value is 1.2
print(lowestKey);
}
-
-
Return the lowest number currently stored in the Dictionary.
Returns:
Number
Example
function setup() {
let myDictionary = createNumberDict({ 2: -10, 4: 0.65, 1.2: 3 });
let lowestValue = myDictionary.minValue(); // value is -10
print(lowestValue);
}
-
-
Multiply the given number with the value currently stored at the given key.
The product then replaces the value previously stored in the Dictionary.
Parameters:
Name |
Type |
Description |
Key |
Number
|
for value you wish to multiply |
Amount |
Number
|
to multiply the value by |
Example
function setup() {
let myDictionary = createNumberDict(2, 4);
myDictionary.mult(2, 2);
print(myDictionary.get(2)); // logs 8 to console.
}
-
-
Subtract the given number from the value currently stored at the given key.
The difference then replaces the value previously stored in the Dictionary.
Parameters:
Name |
Type |
Description |
Key |
Number
|
for the value you wish to subtract from |
Number |
Number
|
to subtract from the value |
Example
function setup() {
let myDictionary = createNumberDict(2, 5);
myDictionary.sub(2, 2);
print(myDictionary.get(2)); // logs 3 to console.
}