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
+9.2k Golang : How to check if a string with spaces in between is numeric?
+8.6k Golang : Another camera capture GUI application with GTK and OpenCV
+6.8k Swift : substringWithRange() function example
+9.3k Golang : Generate random Chinese, Japanese, Korean and other runes
+7.5k Golang : Rot13 and Rot5 algorithms example
+13.2k Golang : Convert(cast) int to int64
+16.5k Golang : Check if a string contains multiple sub-strings in []string?
+5.5k Clean up Visual Studio For Mac installation failed disk full problem
+4.6k MariaDB/MySQL : How to get version information
+24.5k Golang : Change file read or write permission example
+10.6k Golang : How to unmarshal JSON inner/nested value and assign to specific struct?