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
+8.3k Golang : Check if integer is power of four example
+19.2k Golang : Populate dropdown with html/template example
+25.4k Golang : Generate MD5 checksum of a file
+8.4k Golang : Convert word to its plural form example
+22.4k Golang : How to read JPG(JPEG), GIF and PNG files ?
+14.6k Golang : GUI with Qt and OpenCV to capture image from camera
+16.3k Golang : How to extract links from web page ?
+12.1k Golang : Perform sanity checks on filename example
+9.4k Golang : Scramble and unscramble text message by randomly replacing words
+18.4k Golang : How to remove certain lines from a file
+6.9k Mac OSX : Find large files by size
+5.3k Golang : Generate Interleaved 2 inch by 5 inch barcode