# Dictionaries

## Overview

Strings for keys, Integers for values.

Dictinaries do not allow dublicate keys to exist.

## Sample Codes

### Standart Array

```swift
var employee = ["Taylor Swift", "Singer", "Nashville"]
```

### Dictionary type

#### Standart use

```swift
let employee2 = [
    "name": "Taylor Swift",
    "job": "Singer", 
    "location": "Nashville"
]
```

#### If error

```swift
let olympics = [
    2012: "London",
    2016: "Rio de Janeiro",
    2021: "Tokyo"
]

print(olympics[2012, default: "Unknown"])
print(olympics[2013, default: "Unknown"]) // in error the result is "Unknown" #learn
```

#### Empty dictionery

```swift
var heights = [String: Int]()
heights["Yao Ming"] = 229
heights["Shaquille O'Neal"] = 216
heights["LeBron James"] = 206
```

## Sources

### Videos

### Articles / Documents

* <https://www.hackingwithswift.com/quick-start/beginners/how-to-store-and-find-data-in-dictionaries>
