Golang container/list.Element.Prev() function example
package container/list
Prev returns the previous list element or nil.
Golang container/list.Element.Prev() 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("Prev")
for e := alist.Back(); e != nil; e = e.Prev() {
fmt.Println(e.Value) // print out the elements
}
}
Output :
Prev
c
b
a
Reference :
Advertisement
Something interesting
Tutorials
+15.9k Golang : Get current time from the Internet time server(ntp) example
+11.3k Golang : How to use if, eq and print properly in html template
+20.5k Golang : Pipe output from one os.Exec(shell command) to another command
+9.9k Golang : Function wrapper that takes arguments and return result example
+13.3k Golang : Linear algebra and matrix calculation example
+4.9k HTTP common errors and their meaning explained
+9.4k Golang : Detect Pascal, Kebab, Screaming Snake and Camel cases
+9.6k Golang : How to generate Code 39 barcode?
+9.2k Golang : Create and shuffle deck of cards example
+5.1k Golang : Check if a word is countable or not
+5.4k Golang : Reclaim memory occupied by make() example
+10.8k Android Studio : Checkbox for user to select options example