summaryrefslogtreecommitdiff
path: root/docs/type_system/option.md
blob: 55e6b76dc9e83c271ec3bbc2aac2f2ea5c908ad0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Option

---

A 128bit status value pair, cannot be stored.

An option represents not having a value is a possibility

```text
Option[TYPE]
```

# Default

```text
x : // something that returns an option
// x is the value from the option
```

If option is none an error is thrown

## Use with `Empty` qualifier

If the option is assigned to a type with `Empty`, no error is thrown. The empty value will be `nil` if the option is `none`

# Matching

```text
# ... {
    .some { arg; ... }[arg]
    .nome { ... }
}
```

## .some

## .none

# Return

## \`some

## \`none