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

Function ExampleOption_OrElse_some

option_example_test.go:163–169  ·  view source on GitHub ↗

func ExampleOption_MustGet_none() { none := None[int]() result := none.MustGet() fmt.Println(result) // Output: panics }

()

Source from the content-addressed store, hash-verified

161// }
162
163func ExampleOption_OrElse_some() {
164 some := Some(42)
165 result := some.OrElse(1234)
166
167 fmt.Println(result)
168 // Output: 42
169}
170
171func ExampleOption_OrElse_none() {
172 none := None[int]()

Callers

nothing calls this directly

Calls 2

SomeFunction · 0.85
OrElseMethod · 0.45

Tested by

no test coverage detected