Count: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle mNo edit summary |
imported>StDoodle m } => ) |
||
Line 24: | Line 24: | ||
item [int] my_map; | item [int] my_map; | ||
boolean newkey(item i) { | boolean newkey(item i) { | ||
map[count(map | map[count(map)] = i; | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 22:00, 10 March 2010
Function Syntax
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
Special
This function returns 0 for an empty map (i.e. with 0 keys).