Golang container/list.List.Back() function example

package container/list

Back returns the last element of list l or nil.

Golang container/list.List.Back() function usage example

 package main

  import (
 "container/list"
 "fmt"
  )

  func main() {
 alist := list.New()
 alist.PushBack("a")
 alist.PushBack("b")
 alist.PushBack("c")

 e := alist.Back()
 fmt.Println(e.Value)
 }

Output :

c

Reference :

http://golang.org/pkg/container/list/#List.Back

Advertisement