Key and Value Output. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Key and Value Output.

So in most cases the key is used to output the value, but can it work the other way around? For example, Say the key is dave and the value is 27. Can I use 27 to access dave?

2nd Dec 2016, 1:24 PM
Parash Patel
Parash Patel - avatar
2 Answers
0
If you're talking about key/value pairs such as using Dictionaries. That i dont think you can use a value to find or access a key. The key is unique whereas the value is not and it just doesnt make sense to do or try such thing.
2nd Dec 2016, 5:06 PM
Ousmane Diaw
0
i will say it doesnt work that way. Because ive tried it and all i got was a runtime error i.e outputs a an error or a message you werent expecting (null as this case implies)
27th Dec 2016, 12:48 AM
Yusuf Muktar