Browse Source

fix some sintax errors in the readme proposed function and program

content-update
Augusto 5 years ago
parent
commit
c2ebaccdda
  1. 13
      subjects/listpushfront.en.md

13
subjects/listpushfront.en.md

@ -17,7 +17,7 @@ type List struct {
Tail *Node Tail *Node
} }
func ListPushFront(l *list, data interface{}) { func ListPushFront(l *List, data interface{}) {
} }
``` ```
@ -29,21 +29,22 @@ Here is a possible [program](TODO-LINK) to test your function :
package main package main
import ( import (
"fmt"
piscine ".." piscine ".."
"fmt"
) )
func main() { func main() {
link := &list{} link := &piscine.List{}
piscine.ListPushFront(link, "Hello") piscine.ListPushFront(link, "Hello")
piscine.ListPushFront(link, "man") piscine.ListPushFront(link, "man")
piscine.ListPushFront(link, "how are you") piscine.ListPushFront(link, "how are you")
for link.head != nil { it := link.Head
fmt.Println(link.head.data) for it != nil {
link.head = link.head.next fmt.Println(it.Data)
it = it.Next
} }
} }
``` ```

Loading…
Cancel
Save