getOrDefault: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " |game1= arma3dev |version1= 2.01" to " |game1= arma3 |version1= 2.02") |
(added new parameter) |
||
Line 16: | Line 16: | ||
|p3= defaultValue: [[Anything]] - (Optional, default [[nil]]) | |p3= defaultValue: [[Anything]] - (Optional, default [[nil]]) | ||
|p4= setDefault: [[Anything]] - (Optional) - If value does not exist, '''defaultValue''' will be added to the Hash Map {{Since|arma3|2.04|y}} | |||
|r1= [[Anything]] | |r1= [[Anything]] |
Revision as of 10:37, 16 March 2021
Description
- Description:
- Retrieves a value out of a HashMap after looking it up by its key. When the HashMap doesn't contain the key, the default value is returned
- Groups:
- HashMap
Syntax
- Syntax:
- hashMap getOrDefault [key, defaultValue]
- Parameters:
- hashMap : HashMap
- key: HashMapKey
- defaultValue: Anything - (Optional, default nil)
- setDefault: Anything - (Optional) - If value does not exist, defaultValue will be added to the Hash Map Template:Since
- Return Value:
- Anything
Examples
- Example 1:
private _myValue = _myHashMap getOrDefault ["a", "Not Found!"];
Additional Information
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note