From Kolmafia
Jump to navigation Jump to search

Function Syntax

void clear(aggregate map )

  • map is the aggregate to clear

Clears the aggregate map of all its keys & data.

Code Samples

Tells you how many different items you have and then clears the map.

int[item] inventory = get_inventory();
print("You currently have "+count(inventory)+" different items in your inventory.", "blue");
print("Now there are "+count(inventory)+" different items in the inventory map.", "blue");

The clear command is most often used when doing lots of map manipulation, since maps only grow in size when assigning values to them.

See Also

count() | file_to_map() | map_to_file()