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
+5.4k Gogland : Datasource explorer
+9.4k Android Studio : Indicate progression with ProgressBar example
+17.7k Golang : [json: cannot unmarshal object into Go value of type]
+13.6k Golang : Get user input until a command or receive a word to stop
+9.1k Golang : io.Reader causing panic: runtime error: invalid memory address or nil pointer dereference
+9.5k Golang : Detect Pascal, Kebab, Screaming Snake and Camel cases
+10.4k Golang : Meaning of omitempty in struct's field tag
+18k Golang : Get all upper case or lower case characters from string example
+16.3k Golang : Find out mime type from bytes in buffer
+8.9k Golang : Find network service name from given port and protocol
+7.5k Golang : Shuffle strings array