()
| 6 | ) |
| 7 | |
| 8 | func ExampleDo() { |
| 9 | a := Ok("Hello, World!") |
| 10 | b := Some("42") |
| 11 | |
| 12 | result := Do(func() []string { |
| 13 | return []string{ |
| 14 | a.MustGet(), |
| 15 | b.MustGet(), |
| 16 | } |
| 17 | }) |
| 18 | |
| 19 | fmt.Println(result.IsError()) |
| 20 | fmt.Println(result.MustGet()) |
| 21 | // Output: |
| 22 | // false |
| 23 | // [Hello, World! 42] |
| 24 | } |
| 25 | |
| 26 | func ExampleDo_panic() { |
| 27 | a := Ok("Hello, World!") |