Hello everyone. Please tell me how to check the presence of a key in mapping?

Is there an opportunity to do something like:
if key not in mappingArr:

Jul 12, 2023, 5:31 PM
There is no enumeration for keys in a mapping. Depending on the usecase, you can maybe check for non zero value for a given pair. Very nasty workaround, but could help sometimes
Or use a standard library like EnumerableMapping for a much cleaner solution
Jul 12, 2023, 5:39 PM

© 2024 Draquery.com All rights reserved.