I have this nested array:
array = [
["A", "X"],
["B", "Y"],
["C", "Z"]
]
Is there a function that returns "B" when I provide "Y" and "C" when I provide "Z"?
I have this nested array:
array = [
["A", "X"],
["B", "Y"],
["C", "Z"]
]
Is there a function that returns "B" when I provide "Y" and "C" when I provide "Z"?
rassoc might be what you need.
array.rassoc("Y") would return ["B", "Y"] and you can use first to get only the "B".