Count

From Kolmafia
Revision as of 07:25, 10 March 2010 by imported>Heeheehee (Created page with example.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

int count(aggregate map )

Returns the number of keys in the specified aggregate.

Code Samples

This example function uses count to create a new key in a map (defined outside the function to hopefully eliminate some confusion).

item [int] my_map;
boolean newkey(item i) {
   map[count(map}] = i;
}

See Also

file_to_map() | clear()

Special

This function returns 0 for an empty map (i.e. with 0 keys).