# Map

Operators and functions for working with map arrays (**map** type) are described here. **map.typename** means that you can specify any type name but in the case of the binary operator this type must be the same in both maps.

* [bool( map.typename m ) bool](/stdlib/map.md#bool-map-typename-m-bool)
* [Del( map.typename m, str key ) map.typename](/stdlib/map.md#del-map-typename-m-str-key-map-typename)
* [IsKey( map.typename m, str key ) bool](/stdlib/map.md#iskey-map-typename-m-str-key-bool)
* [Key( map.typename m, int index ) str](/stdlib/map.md#key-map-typename-m-int-index-str)

## Operators

| Operator                         | Result       | Description                                                                    |
| -------------------------------- | ------------ | ------------------------------------------------------------------------------ |
| **\*** map.typename              | int          | Returns the number of elements in the map.                                     |
| map.typename **?**               | bool         | Calls *bool(map.typename)*.                                                    |
| map.typename **=** map.typename  | map.typename | Assignment operator.                                                           |
| map.typename **&=** map.typename | map.typename | Creates a clone of the map. The new variable will work with the same data set. |
| map.typename **\[** str **]**    | typename     | Sets/gets a map value by key.                                                  |

## Functions

### bool(map.typename m) bool

The *bool* function returns *false* if the map is empty, otherwise, it returns *true*.

### Del( map.typename m, str key ) map.typename

The *Del* function deletes the specified key and its value from the *map* array. The *m* parameter is returned.

### IsKey( map.typename m, str key ) bool

The *IsKey* function returns *true* if there is a value with the specified key in the *map* and *false*, otherwise.

### Key( map.typename m, int index ) str

The *Key* function returns the item key by its index. For example, this function can be used in the *for* loop to get the item key.

```go
for val,i in mymap {
    Println("\(Key(mymap, i)):\(val)")
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gentee.org/stdlib/map.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
