switch(key,defaultValue,keyValueChoices)¶
Definition¶
Object switch(Object key, Object defaultValue, Object ... keyValueChoices)
Description¶
Given a mapping of key/value pairs and a supplied key, returns the associated value, or a defaultValue if the supplied key does not exist in the provided mapping.
Parameter Definition¶
Name | Type | Description |
---|---|---|
key | Object | the key used to look up a value in the map |
defaultValue | Object | the defaultValue to return if the key is not found in supplied keyValueChoices |
keyValueChoices | Object... | An even number of arguments ordered such that: key1,value2,key2,value2,.... KEYS MUST EVALUATE TO CONSTANT EXPRESSIONS AND BE UNIQUE |