shad-go/treeiter/treeiter_example_test.go

25 lines
332 B
Go
Raw Normal View History

2022-02-19 23:23:36 +00:00
package treeiter
import "fmt"
func ExampleDoInOrder() {
tree := &ValuesNode[string]{
value: "root",
left: &ValuesNode[string]{
value: "left",
},
right: &ValuesNode[string]{
value: "right",
},
}
DoInOrder(tree, func(t *ValuesNode[string]) {
fmt.Println(t.value)
})
// Output:
// left
// root
// right
}