We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9b2a632 + b6ab9b7 commit 76d66b8Copy full SHA for 76d66b8
example/main.go renamed to example/return/main.go
example/return_by_func/main.go
@@ -0,0 +1,22 @@
1
+package main
2
+
3
+import (
4
+ "fmt"
5
+ if_expression "github.com/golang-infrastructure/go-if-expression"
6
+)
7
8
+func main() {
9
10
+ r := if_expression.ReturnByFunc(true, func() string {
11
+ fmt.Println("True分支被执行了")
12
+ return "是"
13
+ }, func() string {
14
+ fmt.Println("False分支被执行了")
15
+ return "否"
16
+ })
17
+ fmt.Println(r)
18
+ // Output:
19
+ // True分支被执行了
20
+ // 是
21
22
+}
0 commit comments