# Enums (Enumerations)

## Overview

In strings, there are many possible options for one particular item or column. For example, you may write to the name column  in different ways like:

* "Monday"
* "Monday "&#x20;
* "monday "
* "February"

Thus this will give erroneous results. To prevent this, you should carefully analyze your data regularly, if not every time.

You create a list of data in a particular "enum" so that you will choose from that list to prevent entering wrong data.

```swift
// First way
enum Weekday {
    case monday
    case tuesday
    case wednesday
    case thursday
    case friday
}

// Second way
enum Weekday {
    case monday, tuesday, wednesday, thursday, friday
}

// Usage
var day = Weekday.monday
day = Weekday.tuesday
day = Weekday.friday
```

### Comparing

```swift
enum Sizes: Comparable {
    case small
    case medium
    case large
}

let first = Sizes.small
let second = Sizes.large
print(first < second) // compile: small

// Because in enum list, "small" comes before "large"
```

## Sources

### Videos

{% embed url="<https://youtu.be/bwqbf-1_7gE>" %}
[Hacking with Swift / How to create and use enums](https://www.hackingwithswift.com/quick-start/beginners/how-to-create-and-use-enums)
{% endembed %}

### Articles / Documents

*
