keyForValue
-
function
-
new in 1.61
-
Returns the key corresponding to a particular value in a property list, or empty if the property list does not contain that value. If more than one property is equal to the specified value, the key to one of these values is returned.
-
Examples: +
set myPets to (cat:"Yellow", dog:"Black")
put keyForValue(myPets, "Black") -- dog
put myPets.keyForValue("Yellow") -- catset scores to (dan:21, betty:12, carl:13, ann:21, sue:18)
put keyForValue(scores, 21) —> ann
put scores.keyForValue(12) —> betty -
Related: allKeysForValue