MCPcopy
hub / github.com/samber/mo / ExampleResult_OrElse_ok

Function ExampleResult_OrElse_ok

result_example_test.go:185–191  ·  view source on GitHub ↗

func ExampleResult_MustGet_err() { ko := Err[int](err) result := ko.MustGet() fmt.Println(result) // Output: panics }

()

Source from the content-addressed store, hash-verified

183// }
184
185func ExampleResult_OrElse_ok() {
186 ok := Ok(42)
187 result := ok.OrElse(1234)
188
189 fmt.Println(result)
190 // Output: 42
191}
192
193func ExampleResult_OrElse_err() {
194 ko := Err[int](err)

Callers

nothing calls this directly

Calls 2

OkFunction · 0.85
OrElseMethod · 0.45

Tested by

no test coverage detected