Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(500)

Unified Diff: 2014/go4gophers/tree-walk.go

Issue 97780044: code review 97780044: go.talks: add "Go for Gophers" slides (Closed)
Patch Set: diff -r 2b96b82cd80d https://code.google.com/p/go.talks Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « 2014/go4gophers/tree-thread.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: 2014/go4gophers/tree-walk.go
===================================================================
new file mode 100644
--- /dev/null
+++ b/2014/go4gophers/tree-walk.go
@@ -0,0 +1,21 @@
+package main
+
+import (
+ "fmt"
+
+ "code.google.com/p/go-tour/tree"
+)
+
+func Walk(t *tree.Tree) {
+ if t.Left != nil {
+ Walk(t.Left)
+ }
+ fmt.Println(t.Value)
+ if t.Right != nil {
+ Walk(t.Right)
+ }
+}
+
+func main() {
+ Walk(tree.New(1))
+}
« no previous file with comments | « 2014/go4gophers/tree-thread.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b