-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path11_list.go
39 lines (35 loc) · 937 Bytes
/
11_list.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Seriál "Programovací jazyk Go"
// https://www.root.cz/serialy/programovaci-jazyk-go/
//
// Devátá část
// Užitečné balíčky pro každodenní použití jazyka Go
// https://www.root.cz/clanky/uzitecne-balicky-pro-kazdodenni-pouziti-jazyka-go/
//
// Repositář:
// https://github.com/tisnik/go-root/
//
// Seznam demonstračních příkladů z deváté části:
// https://github.com/tisnik/go-root/blob/master/article_09/README.md
//
// Demonstrační příklad číslo 11:
// Použití standardního balíčku "container/list"
//
// Dokumentace ve stylu "literate programming":
// https://tisnik.github.io/go-root/article_09/11_list.html
package main
import (
"container/list"
"fmt"
)
func printList(l *list.List) {
for e := l.Front(); e != nil; e = e.Next() {
fmt.Println(e.Value)
}
}
func main() {
l := list.New()
l.PushBack("foo")
l.PushBack("bar")
l.PushBack("baz")
printList(l)
}