Skip to content

Commit

Permalink
improve example
Browse files Browse the repository at this point in the history
  • Loading branch information
thinhdanggroup committed Apr 1, 2020
1 parent 4edd642 commit d319310
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,20 @@ for i := 0; i < 10; i++ {
executor.Publish(func(input int) {
fmt.Printf("2 ^ %d = %d \n", input, input^2)
}, i)

executor.Publish(func(a int, b int) {
fmt.Printf("%d + %d = %d \n", a, b, a+b)
}, i, i+1)
}

// Output:
// 2 * 0 = 0
// 2 ^ 0 = 2
// 2 ^ 1 = 3
// 2 ^ 2 = 0
// 1 + 2 = 3
// 2 * 2 = 4
// 2 * 1 = 2
// 2 ^ 0 = 2
// 2 ^ 2 = 0
// 2 + 3 = 5
// 0 + 1 = 1
// 2 * 1 = 2
```
4 changes: 4 additions & 0 deletions examples/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ func main() {
executor.Publish(func(input int) {
fmt.Printf("2 ^ %d = %d \n", input, input^2)
}, i)

executor.Publish(func(a int, b int) {
fmt.Printf("%d + %d = %d \n", a, b, a+b)
}, i, i+1)
}

}

0 comments on commit d319310

Please sign in to comment.