Golang container/list.List.PushBack() function example
package container/list
PushBack inserts a new element e with value at the back of list l and returns the new element.
Golang container/list.List.PushBack() function usage example
package main
import (
"container/list"
"fmt"
)
func main() {
alist := list.New()
alist.PushBack("a")
alist.PushBack("b")
alist.PushBack("c")
alist.PushBack("d")
for e := alist.Front(); e != nil; e = e.Next() {
fmt.Println(e.Value) // print out the elements
}
}
Output :
a
b
c
d
Reference :
Advertisement
Something interesting
Tutorials
+7.8k Swift : Convert (cast) String to Double
+12.1k Golang : Perform sanity checks on filename example
+5.7k List of Golang XML tutorials
+25.2k Golang : Storing cookies in http.CookieJar example
+20.2k Golang : How to get own program name during runtime ?
+4.7k Adding Skype actions such as call and chat into web page examples
+6.9k Mac OSX : Find large files by size
+11.5k Golang : Generate DSA private, public key and PEM files example
+10.9k Golang : Sieve of Eratosthenes algorithm
+9.4k Golang : Play .WAV file from command line
+27.6k Golang : dial tcp: too many colons in address
+19.2k Golang : Execute shell command