2

The current method of accessing dictionary keys is through the use of the <dictionary_name>.keys field.

However, this may result in resource exhaustion for large dictionaries.

How can I iterate over the keys for the dictionary, instead of all the keys as an array?

Rohit Gupta
  • 4,022
  • 20
  • 31
  • 41
  • 2
    This should be addressed to Cadence's support channels. – Mat Apr 19 '23 at 16:57
  • 1
    @Satyam Instead of posting a feature request, please rephrase into a question for what you are trying to achieve, like "How can I iterate over a dictionary in Cadence?" – turbolent Apr 19 '23 at 17:06

1 Answers1

2

Dictionaries have a fun forEachKey(_ function: ((K): Bool)): Void function.

turbolent
  • 288
  • 1
  • 6