MCPcopy Index your code
hub / github.com/cli/cli / ExampleOption_UnwrapOrElse

Function ExampleOption_UnwrapOrElse

pkg/option/option_test.go:45–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43}
44
45func ExampleOption_UnwrapOrElse() {
46 fmt.Println(o.Some(4).UnwrapOrElse(func() int {
47 return 3
48 }))
49
50 fmt.Println(o.None[int]().UnwrapOrElse(func() int {
51 return 3
52 }))
53
54 // Output:
55 // 4
56 // 3
57}
58
59func ExampleOption_UnwrapOrZero() {
60 fmt.Println(o.Some(4).UnwrapOrZero())

Callers

nothing calls this directly

Calls 2

PrintlnMethod · 0.80
UnwrapOrElseMethod · 0.80

Tested by

no test coverage detected