Methods

countΒΆ

count(h:Hash, predicate:Any)

Count number of key-value pairs in Hash that satisfy the predicate.
Source: stdlib.ngs:1720

h

Hash to check

predicate

Test function to be called with one key and one value at a time

Returns

Int

Example

{'a': 1, 'b': 2, 'c': 11}.count(F(k, v) v>10)  # 1