]> Cypherpunks repositories - gostls13.git/commitdiff
container/list: document iteration
authorAndrew Gerrand <adg@golang.org>
Thu, 28 Oct 2010 21:48:16 +0000 (08:48 +1100)
committerAndrew Gerrand <adg@golang.org>
Thu, 28 Oct 2010 21:48:16 +0000 (08:48 +1100)
R=rsc
CC=golang-dev
https://golang.org/cl/2768042

src/pkg/container/list/list.go

index 578864dbe66a157c4f57908873d37a8c1d04817b..ddc8611819a90d5df30098b70cf9d936299cc4f9 100644 (file)
@@ -3,6 +3,12 @@
 // license that can be found in the LICENSE file.
 
 // The list package implements a doubly linked list.
+//
+// To iterate over a list (where l is a *List):
+//     for e := l.Front(); e != nil; e = e.Next() {
+//             // do something with e.Value
+//     }
+//
 package list
 
 // Element is an element in the linked list.