mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-30 16:48:40 +00:00
21 lines
330 B
Go
21 lines
330 B
Go
package testb
|
|
|
|
import (
|
|
"github.com/tinygo-org/tinygo/testdata/generics/value"
|
|
)
|
|
|
|
func Test() {
|
|
v := value.New(1)
|
|
vm := value.Map(v, Plus500)
|
|
vm.Get(callback, callback)
|
|
}
|
|
|
|
func callback(v int) {
|
|
println("value:", v)
|
|
}
|
|
|
|
// Plus500 is a `Transform` that adds 500 to `value`.
|
|
func Plus500(value int) int {
|
|
return value + 500
|
|
}
|