()
| 279 | } |
| 280 | |
| 281 | func ExampleOption_FlatMap_some() { |
| 282 | some := Some(42) |
| 283 | result := some.FlatMap(func(i int) Option[int] { |
| 284 | return Some(21) |
| 285 | }) |
| 286 | |
| 287 | fmt.Println(result.IsPresent(), result.OrEmpty()) |
| 288 | // Output: true 21 |
| 289 | } |
| 290 | |
| 291 | func ExampleOption_FlatMap_none() { |
| 292 | none := None[int]() |