Golang container/list.Element.Next() function example
package container/list
Next returns the next list element or nil.
Golang container/list.Element.Next() function usage example
package main
import (
"container/list"
"fmt"
)
func main() {
alist := list.New()
alist.PushBack("a")
alist.PushBack("b")
alist.PushBack("c")
fmt.Println("Next")
for e := alist.Front(); e != nil; e = e.Next() {
fmt.Println(e.Value) // print out the elements
}
}
Output :
Next
a
b
c
Reference :
Advertisement
Something interesting
Tutorials
+9.1k Golang : io.Reader causing panic: runtime error: invalid memory address or nil pointer dereference
+12.4k Golang : Encrypt and decrypt data with x509 crypto
+24.1k Golang : Upload to S3 with official aws-sdk-go package
+17k Golang : Get input from keyboard
+12.6k Golang : flag provided but not defined error
+9.2k Golang : Create and shuffle deck of cards example
+5.8k Golang : Launching your executable inside a console under Linux
+11.6k Golang : Concurrency and goroutine example
+10.6k Golang : Flip coin example
+8.3k Golang : Count leading or ending zeros(any item of interest) example
+13k Golang : Get terminal width and height example