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.1k Golang : Get environment variable
+17.6k Convert JSON to CSV in Golang
+14k Golang: Pad right or print ending(suffix) zero or spaces in fmt.Printf example
+20.2k Golang : Count number of digits from given integer value
+3.6k Java : Get FX sentiment from website example
+31.6k Golang : Get local IP and MAC address
+10.8k Android Studio : Checkbox for user to select options example
+18.4k Golang : How to get hour, minute, second from time?
+14.9k Golang : How to check for empty array string or string?
+10.9k Golang : How to transmit update file to client by HTTP request example
+8.8k Golang : Get final balance from bit coin address example
+13.4k Golang : Increment string example